61caf0427337ef99fba1cf6aeaaaadcd9f846b14
7 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
| 49f087fe40 |
feat(01-10): wave-1 task-2 — welcome page bundle + Vite entries + web_accessible_resources
Plan 01-10 Wave 1: welcome page bundle staged with canonical Plan 01-12
tokens.css @import + chrome.i18n for D-08 tagline (Plan 01-12 path-B
contract).
Files created:
- src/welcome/copy.ts (Russian non-tagline COPY map per D-03 Sober
voice; WELCOME_HERO_RU_FALLBACK + WELCOME_HERO_EN_FALLBACK exported
for the welcome.ts `|| <en-const>` fallback chain).
- src/welcome/welcome.html (lang='ru'; data-mokosh-key + data-mokosh-
i18n-key attribute conventions; SINGLE stylesheet link; D-02 Hero +
body + footer structure; 10 keyed attrs total; <title> populated
via populateCopy).
- src/welcome/welcome.css (FIRST LINE `@import '../shared/tokens.css';`;
ZERO hex literals in source; 65 var(--mks-*) refs; D-02 layout +
--mks-welcome-max-w=720px; --mks-rec madder for recording-related
accents per D-04 Loom palette).
- src/welcome/welcome.ts (vanilla DOM; populateCopy + populateI18n
filter-pipeline form per project rule "no `continue`"; no `as any`;
Logger from src/shared; document.readyState guard; no event
handlers per D-16-toolbar informational charter).
Files modified:
- vite.config.ts: rollupOptions.input gains `welcome:
'src/welcome/welcome.html'`; __VITE_DEV__ + __MOKOSH_UAT__ defines
untouched (Plan 01-12 Wave 5 baseline preserved verbatim).
- vite.test.config.ts: mirror entry in dist-test/; mergeConfig pattern
untouched.
- manifest.json: web_accessible_resources block added after
host_permissions, before background; storage permission preserved
in permissions array; default_locale='en' + __MSG_*__ placeholders
from Plan 01-12 Wave 3 preserved verbatim.
NO src/welcome/welcome-tokens.css file is created — Plan 01-12 must_have
#9 path-B contract: Plan 01-12 landed FIRST (
|
|||
| e8d2881874 |
feat(01-12): wave-5 task-1 — welcome i18n migration (conditional on 01-10) + __VITE_DEV__ define + scripts/README.md
Plan 01-10 (welcome tab) has NOT yet landed at execute-plan time
(verified: ls src/welcome/welcome.html returns absent). Per Wave 5
branch 2B, src/welcome/* file modifications are DEFERRED — when Plan
01-10 lands, its executor will use src/shared/tokens.css directly
(skipping the placeholder welcome-tokens.css step entirely; the
canonical tokens.css is already import-ready from src/shared/).
Unconditional changes in this wave:
1. vite.config.ts gains __VITE_DEV__ define-token (RESEARCH §12 +
D-09 spirit-satisfaction). Defaults to false; activates iff env
var VITE_DEV=1 is set. Reserved for any future inline smoke-mode
check. Currently smoke.sh lives entirely outside Vite's input set
so the gate is a defensive no-op:
define: { __MOKOSH_UAT__: 'false', __VITE_DEV__: JSON.stringify(...) }
2. vite.test.config.ts inherits __VITE_DEV__ via mergeConfig (the
test config only overrides __MOKOSH_UAT__: 'true'; __VITE_DEV__
from base flows through untouched).
3. scripts/README.md (NEW, ~50 lines): documents the smoke-isolation
invariant — dev-only scripts in scripts/ are NOT bundled by
`npm run build`; the production dist/ contains zero smoke
artifacts (verified by RESEARCH §12 grep gate). Provides usage
example for VITE_DEV env override + cross-references RESEARCH §12
and brand-decisions-v1.md D-09. Index lists subset-fonts.sh,
rasterize-icons.sh, and smoke.sh (if present).
Note on Plan 01-10 deferral: when Plan 01-10 executes after this
plan closes, the welcome page src/welcome/welcome.css can either
@import '../shared/tokens.css' directly OR a thin welcome-tokens.css
re-export — both paths are supported by the canonical tokens.css
landed in Wave 1. Plan 01-10's executor must adopt chrome.i18n.getMessage
for any welcome copy strings using the 16-key matrix in _locales/
(welcomeHeroRu + welcomeHeroEn already defined; additional keys
added per Plan 01-10's own artifact list).
Verification:
- vitest baseline 147/147 GREEN (no change from Wave 4 close)
- npm run build clean (no warnings; __VITE_DEV__ propagates through
define static replacement)
- scripts/README.md exists with the smoke-isolation paragraph
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|||
| cb1a729962 |
feat(01-11): wave-1 — gated test hooks for SW + offscreen, dist/ stays hook-free
Task 2 of Plan 01-11 (Puppeteer UAT harness).
Test hook surface:
- src/test-hooks/types.ts: canonical MokoshTestSurface — handlers
(onClicked, onStartup, notificationOnClicked), notificationCount,
lastNotificationOptions<true>, notificationIds, getCurrentStream,
getSegmentCount. globalThis.__mokoshTest ambient declaration.
- src/test-hooks/sw-hooks.ts: SW-side hook. Monkey-patches addListener
on chrome.action.onClicked / chrome.runtime.onStartup / chrome
.notifications.onClicked to capture handler refs while chaining to
the original. Wraps chrome.notifications.create across all four
overload shapes (id+options+cb, options+cb, id+options→Promise,
options→Promise) to increment notificationCount, save
lastNotificationOptions, push resolved id into notificationIds.
- src/test-hooks/offscreen-hooks.ts: offscreen-side hook. Exports
setCurrentStream + setSegmentCountGetter; the recorder calls both
inside startRecording after the mediaStream + segments assignments.
getCurrentStream getter closes over the cell so the harness reads
the live MediaStream for displaySurface inspection + 'ended'
dispatch (Bug B BLOCKER per RESEARCH §7).
- tests/uat/lib/test-hook-contract.d.ts: manual harness-side mirror of
MokoshTestSurface (decoupled from src/ to keep tests/ import-clean
per RESEARCH §11 resolution 5; drift risk documented inline).
Production-side wires (gated by __MOKOSH_UAT__ token):
- src/background/index.ts top-of-module: `if (__MOKOSH_UAT__) { await
import('../test-hooks/sw-hooks'); }`. MUST run before any chrome.*
addListener call below — top-of-module placement satisfies this.
- src/offscreen/recorder.ts top-of-module: symmetric gated dynamic
import + module-scoped testHooks reference.
- src/offscreen/recorder.ts inside startRecording (after mediaStream
assignment): `if (__MOKOSH_UAT__) { testHooks?.setCurrentStream(stream);
testHooks?.setSegmentCountGetter(() => segments.length); }`
- src/offscreen/recorder.ts inside onUserStoppedSharing (after
mediaStream = null): `if (__MOKOSH_UAT__) { testHooks?.setCurrentStream(null); }`
— T-1-11-05 (Repudiation: stale stream ref) mitigation.
Build-time token wiring:
- vite.config.ts: declares `define: { __MOKOSH_UAT__: 'false' }` (prod
default) + bumps `build.target: 'es2022'` so the top-level await in
the gated dynamic imports compiles (MDN: Chrome 89 / Edge 89 /
Firefox 89 / Safari 15 support TLA; MV3 floor Chrome 88 is
effectively Chrome 89+ in field — comfortably inside the envelope).
- vite.test.config.ts: overrides `define: { __MOKOSH_UAT__: 'true' }`
so the test bundle has the hooks active.
- vitest.config.ts: declares `define: { __MOKOSH_UAT__: 'false' }` for
vitest's own source-loading runs. CRITICAL — without this, vitest
would throw `ReferenceError: __MOKOSH_UAT__ is not defined` when
loading src/background/index.ts; OR if we'd used `import.meta.env.MODE
=== 'test'` (RESEARCH §6's initial guidance), vitest's default
MODE='test' would have ACTIVATED the hooks under unit tests +
clobbered every existing vi.fn() chrome.notifications.create mock.
The dedicated `__MOKOSH_UAT__` token sidesteps both failure modes
cleanly — a refinement on RESEARCH §6 documented in the comment
preambles of all three configs.
- globals.d.ts: declares `__MOKOSH_UAT__: boolean` ambient so
`npx tsc --noEmit` passes without per-file annotations.
- tsconfig.json: include adds `globals.d.ts`.
Notification options generic refinement:
- chrome.notifications.NotificationOptions is declared with a
`<true | false>` generic distinguishing "create" (all required —
true) from "update" (all optional — false). Plan 01-11's production
code always uses the create shape; types.ts + sw-hooks.ts pin to
`NotificationOptions<true>` so the harness reads iconUrl etc. as
definitely-present.
Verification:
- npx tsc --noEmit: exit 0
- npm run build: exit 0
- grep -rln '__mokoshTest\|simulateUserStop\|getSegmentCount\|setCurrentStream\|setSegmentCountGetter' dist/:
ZERO matches (Tier-1 gate stays GREEN)
- npm run build:test: exit 0; dist-test/ emits separate sw-hooks-*.js
+ offscreen-hooks-*.js chunks (the gated dynamic imports survive
tree-shaking when __MOKOSH_UAT__ === true)
- grep -rln '__mokoshTest' dist-test/: 2 matches
(assets/sw-hooks-*.js + assets/offscreen-hooks-*.js)
- SKIP_BUILD=1 npx vitest run: 89/89 GREEN
(83 baseline + 6 Tier-1 hook-leak surfaces)
- sw-bundle-import.test.ts: GREEN (the gated dynamic import does not
break production module init — the `if (false)` branch is never
reachable so the await + import are dead code in dist/)
In-flight bugs auto-fixed (Rule 1 + Rule 3):
- Rule 3: original RESEARCH §6 plan called for `import.meta.env.MODE
=== 'test'` as the gate; switched to `__MOKOSH_UAT__` define-token
after observing vitest contamination (vitest defaults MODE='test'
→ hooks activated under unit tests → 8 existing tests broke with
"Cannot read properties of undefined (reading 'calls')" because the
hook wrapper replaced vi.fn() mocks). Documented in the comment
preambles of all three configs as a refinement on RESEARCH §6.
- Rule 3: esbuild rejected TLA against the default ES2020 target;
bumped to es2022 (Chrome 89+ supports TLA per MDN — inside MV3
envelope). Recorded in vite.config.ts preamble.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|||
| dd7bf00d1d |
fix(01-08): B+ — vite-plugin-node-polyfills for Buffer (resolves runtime ts-ebml crash)
Layer 2 of the extended SW-bundle-import gate caught a runtime
ReferenceError: Buffer is not defined at EBMLDecoder.constructor
(this._buffer = Buffer.alloc(0)). Reached from remuxSegments via
extractFramesFromSegment for every input segment — would crash
the SW on every SAVE_ARCHIVE click in real Chrome.
ts-ebml has a 5-year-old open issue (legokichi/ts-ebml#37,
"Can't use Buffer in browser") acknowledging the incompatibility
with no maintainer fix. The canonical Vite workaround is
vite-plugin-node-polyfills with a narrow Buffer-only config (per
the plugin author's official docs).
Changes:
- vite-plugin-node-polyfills@0.27.0 added as devDependency
- vite.config.ts adds nodePolyfills plugin with narrow config:
include: ['buffer'], globals.Buffer: true, globals.global: false,
globals.process: false, protocolImports: false (Buffer only, no
stdlib pull-in)
- bundle delta: SW chunk 373.05 kB (-0.49 kB vs C-config alone);
+27.48 kB shared polyfill chunk (index-CgqXENQe.js, used by SW
and offscreen). Net cost ~26.3 kB for full Buffer support.
Bundle verification:
- bundled EBMLDecoder.js now reads `this._buffer = me.alloc(0)`
where `me` is the imported polyfill Buffer (was `Buffer.alloc(0)`
against undefined globalThis.Buffer). Same rewrite applied to
all 3 Buffer.alloc/Buffer.concat/Buffer.from sites in ts-ebml.
- bundle does NOT depend on globalThis.Buffer (the polyfill
rewrites references as imports, not as global assignments) —
Layer 1 of the gate still strips Buffer from globalThis and
passes, confirming this.
Layer 2 gate: RED → GREEN. resolve.alias.ebml fix from commit
|
|||
| 52c76362ae |
fix(01-08): resolve ebml via CJS main entry to bypass Vite/Rollup tree-shake bug
Vite's @rollup/plugin-commonjs failed to bridge ts-ebml's
`require("ebml")` against ebml's mixed-main/module/browser package.
Rollup tree-shook ebml.esm.js entirely, leaving `var Pc={}` as a
dangling placeholder. ts-ebml/tools.js's destructure
`{tools:f}=Pc` threw TypeError at SW top-level module init,
blocking handler registration -> chrome://serviceworker-internals
Status=STARTING forever.
`resolve.alias: { ebml: 'ebml/lib/ebml.js' }` forces resolution to
the CJS main entry whose assignment-style exports survive
plugin-commonjs's namespace allocation. Empirically verified:
bundle init progresses ~340 KB further; readVint error gone.
Probes C1 (resolve.mainFields), C2 (treeshake.moduleSideEffects),
C3 (C1+C2 combined), C4 (commonjsOptions.strictRequires) were
all falsified before C-config landed.
Resolves: .planning/debug/01-08-sw-incompatibility.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|||
| 23e69d0b77 |
refactor(01-06): delete inline copy-offscreen plugin and orphan offscreen/ directory
- Delete vite.config.ts inline copy-offscreen plugin (lines 13-216): the 174-line plugin that emitFile'd both offscreen HTML and a stringified JS module wired to tabCapture-era chromeMediaSource + IndexedDB pipeline (audit P0 #1 root cause; D-08 deletion target) - Delete vite.config.ts misplaced publicDir/copyPublicDir (no public/ dir exists; audit P2 #17) and the manualChunks=undefined shape - Rewrite vite.config.ts to RESEARCH.md Example B form: crx() + a single rollupOptions.input.offscreen pointing at src/offscreen/index.html (the crxjs-managed entry Plan 03 created); 21 lines total - Delete orphan offscreen/index.ts (audit P2 #18 dead-code, D-08) - Delete orphan offscreen/index.html (replaced by src/offscreen/index.html per D-07; runtime URL semantics preserved through crxjs entry binding) - T-1-NEW-06-01 grep gate green (this.emitFile = 0) - T-1-NEW-06-02 grep gate green (offscreen/ directory absent) - tsc --noEmit clean; 9/9 vitest tests still green Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
|||
| 555eb0543f |
chore: import broken Phase-1 extension as received
Snapshot of /home/parf/Downloads/manifest.zip as delivered, before any
GSD-driven remediation. Contains a partially-broken first attempt at the
Russian SPEC "Тз расширение фаза1.md" (Phase 1 of operator-session-recorder).
Source layout:
- manifest.json — MV3 declaration with tabCapture/activeTab/downloads/etc.
- src/background/index.ts — service worker (video buffer + archive packaging)
- src/content/index.ts — rrweb + user-event logger
- src/popup/{index.html,index.ts,style.css} — Russian popup UI
- offscreen/{index.html,index.ts} — orphaned offscreen (see audit)
- vite.config.ts — inline plugin emitting a separate live offscreen.js
- generate-icons.js, icons/ — minimal PNG icons
- "Тз расширение фаза1.md" — authoritative Russian SPEC
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|