Repository navigation
feat: add a session event buffer with one cursor and mm events mark - #109
Open
cryptotavares wants to merge 1 commit into
Open
cryptotavares wants to merge 1 commit into
cryptotavares wants to merge 1 commit into
Conversation
This was referenced Nov 18, 2026
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-15-events
branch
from
November 18, 2026 15:45
5c2279c to
72c8e8b
Compare
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-28-cdp-target-events
branch
from
November 18, 2026 15:45
8fab0d4 to
233b290
Compare
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-28-cdp-target-events
branch
from
November 18, 2026 16:59
233b290 to
c0dfe35
Compare
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-15-events
branch
from
November 18, 2026 17:05
72c8e8b to
54fe280
Compare
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-28-cdp-target-events
branch
from
November 18, 2026 17:56
c0dfe35 to
7d46869
Compare
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-15-events
branch
from
November 18, 2026 17:59
54fe280 to
65ef5ed
Compare
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-28-cdp-target-events
branch
from
November 18, 2026 18:39
7d46869 to
73122e8
Compare
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-15-events
branch
from
November 18, 2026 18:43
65ef5ed to
00ddbcc
Compare
Adds one buffer per browser session for console and network records (filled by mm logs and mm network sources in follow-ups). Records share one monotonic seq, so a single 'mm events mark' bookmarks both kinds. Reads are paged with cursor/since/limit and report hasMore, gap (records after the cursor were dropped) and a summary whose startedAt changes on relaunch. Adds URL/text redaction helpers applied before a record enters the buffer. The buffer starts with the session at launch; 'mm events' is browser only and read-only.
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-15-events
branch
from
November 18, 2026 18:45
00ddbcc to
d75e3ac
Compare
cryptotavares
marked this pull request as ready for review
November 18, 2026 18:58
This branch has not been deployed
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.
Description
Important
Stacked on #107 (P2-28, ready to review on
main; review it first). This PR targets #107's branch and contains one commit. #110 (P2-16) and #111 (P2-17) stack on it.mm logs(P2-16) andmm network(P2-17) are streams. An agent needs "everything since the start of this flow" in one cheap, paged, redacted read. It must also know when records were lost (buffer overflow, relaunch). Today there is no session-level event store:CdpManager.subscribe(#107) delivers events, but nothing keeps them.This PR adds that store and its bookmark command. The buffer has no sources yet: P2-16 and P2-17 fill it.
src/events/event-buffer.ts), with one monotonicseqshared by all record kinds (starts at 1 per session). Two kinds, each with its own capacity and drop count:console(1000) andnetwork(2000). A full kind drops its oldest record.read({ kind, cursor?, since?, limit, filter? })→{ records, cursor, hasMore, gap, summary }, oldest first. The returnedcursorcontinues the read with no duplicates or holes.gap: truewhen a record after the cursor (or at/aftersince) was dropped. Acursorabove the newestseq(from an earlier session) is stale: the read starts from the oldest record and reportsgap: true, so a client that compares cursors notices. With bothcursorandsince,gapis approximate (a record dropped after the cursor but beforesinceis not distinguished).limitis clamped to at least 1. A record updated in place later (a network request that finishes) keeps itsseq, so it is never returned twice.summary{ startedAt, seq, counts, dropped }.startedAt(epoch ms) is new for each session, so a reader can detect a relaunch.mm events mark→{ cursor, summary }.mm events clear [--kind console|network]empties the buffer without resettingseq(old cursors stay valid). Unknown arguments (mark --kind x,clear extra, a missing--kindvalue) are usage errors (exit 2).src/events/redact.ts, from feat: add mm network-log, a passive request and console log with service-worker traffic #106'sredactUrl): credentials (user:pass@→[REDACTED]@); host labels and path segments of 24+ letters/digits (32-hex Infura keys); sensitive query and fragment values (feat: record request bodies in mock-network #93's body-field list +key,token,sig,jwt,session,projectId,signature,credential,code, …), matched by exact name and by suffix/prefix after normalization (infuraProjectId,api_token,access_key,x-api-key,authToken,X-Amz-Credential);^authdoes not matchauthor/authors/authorityand^sigonly matchessig/sign/signature, and a JWT or bare key used as a value is redacted even under a harmless name. A JWT path segment is always redacted, and an opaque segment afterv1–v4(≥ 28 chars) is treated as an API key, so a digitless Alchemy key is caught.0xaddresses, 64-hex/base58 IDs afteraccount(s)/address(es)/tx/transaction(s), and UUIDs under a real path are kept; a UUID that is the only path segment is redacted (Blast-style gateway). The same rules apply to URLs inside text; trailing.,;:!?,}and*stay outside the redacted URL, a URL in[...]is matched without its bracket, and a URL with nothing to redact is left byte-for-byte as it appeared. Ascheme://user:pass@URL of a scheme the pattern does not know (ftp:,postgres:,redis:,mongodb+srv:) is redacted by parsing the match, so a path with:and@is not mistaken for a credential. Text (not only URLs) also loses JWTs (eyJ…) andBearervalues (the value needs 8+ token characters, so prose such asthe bearer of good newsstays).passwd,pwd,pass,bearer,seed,pkandmnemonic…names are redacted;publicKey,pubKey,sortKey,cacheKey,primaryKeyandsourceToken…nativeTokenare allowlisted (not secrets). Trailing punctuation is stripped in a backward loop, so a long run is linear (0.3 ms on 100 000 dots; the old regex took 4803.9 ms).launchstarts the session's event sources on browser sessions. It waits at most 5 s and never fails the launch. The firstevents/logs/networkcall starts them again if the CDP manager was replaced.eventsis a read-only, browser-only tool (zod schema, registry, CLI help, README, SKILL.md). Mobile returnsMM_TOOL_NOT_SUPPORTED_ON_PLATFORM.Part of the mm CLI v2 effort: ticket
P2-15(Phase 2). Next: P2-16mm logs(stacked on this PR), P2-17mm network.Shared #93 helper:
redact.tsusesmock-network'sisSensitiveBodyField(now exported) andREDACTED_VALUE, so the body field list has one source. It adds only the query parameter names (key,token,sig, …) and the URL segment rule.Breaking changes
None.
Consumer impact
test/e2e/playwright/llm-workflow/tests/llm-workflow/Proof
Ticket platform: unit. The live run also uses the real daemon + built CLI on an MV3 test extension. The buffer is empty in this PR (no sources).
gap: truesincepaging withlimit:hasMore, no duplicates or holes; an in-place update is not returned againstartedAtchanges on a new session;clearkeepsseqstartedAt 1795010983961 → 1795010991417acrosscleanup+launch)apiKey=, credentials (HTTP and non-HTTP schemes), fragment pairs, JWT path and JWT/Bearerin text, suffix/prefix names, digitless key, UUID only as the sole path segment,0xaddress / 64-hex / base58 kept, URL inside text kept when clean and byte-identicalcursor > seq) reads from the oldest record and reportsgap: truemm events clear --kind)MM_INVALID_INPUT, exit 2Transcript
Unit tests