Repository navigation
Main-process, host and preload bundles as Latin-1 text (about 6 MB off mawsd and the engine host) - #369
Merged
Conversation
…1-bundles.ts) re-prints each main, host and preload chunk holding a character above U+00FF through esbuild's charset=ascii, writes what esbuild leaves in comments and regular expression literals (located by acorn) as \uXXXX, fails the build on any other leftover (a tagged template's raw text) and on any emitted .js file above U+00FF; V8 then holds each file's source at a byte a character (the engine host's 4.5 M characters, main's 6.2 M) Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM
added a commit
that referenced
this pull request
Oct 30, 2026
…les) Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM
added a commit
that referenced
this pull request
Oct 30, 2026
…tin-1 text (#369), about 6 MB off the daemon shape's idle footprint; tracker rows for the renderer's bundles and the hosts' node_modules Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
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.
Every main-process, host and preload bundle is now emitted with no character above U+00FF. Node keeps each loaded file's source in the V8 heap. If a file holds even one character above U+00FF (a curly quote in a log line, a dash in a comment), V8 stores the whole file at two bytes per character. On master, 34 emitted files are like that. They include main's
index.js(6.15 M characters), the engine host (4.47 M), the pty host (0.56 M),mawsd.js, both preloads, and 28 chunks (mostly shiki grammars, plus the identity, identity-file and host-supervisor chunks). After this change, each is held at one byte per character.This lands before O3-D's M7 measured series so that the series measures it.
The change
scripts/latin1-bundles.tsis a Rollup output plugin.electron.vite.config.tswires it into main's output and the preloads' output.transformwithcharset: 'ascii'. esbuild escapes such characters wherever an escape means the same thing: strings, untagged templates, identifiers and property names. A chunk already within Latin-1 is returned as it is.\uXXXXtext, which is inert there.\uXXXX, which matches the same code unit. An identity escape (\—, Annex B) folds into the escape.String.rawincluded): the build fails, because an escape would change the raw text.?modulePathhosts. The host builds take main's output options (electron-vite'sbundleEntryFilemerges main's config), so the engine and pty hosts are re-printed in their own builds. They reach main's bundle as assets.generateBundlefails the build if any emitted.jsfile, chunk or asset, still holds a character above U+00FF.renderStartrefusessourcemap, since the re-print does not chain maps.src/engine-host/bundle-guard.test.tsgains a case that reads every builtout/main/**/*.jsandout/preload/*.jsfile. It catches a config change that drops the plugin, a case where the build itself would still pass.test/latin1-bundles.test.tsruns each transformed program in a VM and compares values with the original. It covers strings, identifiers, comments, and regexes with identity escapes, astral characters,u/vflags and named groups. It also checks the tagged-template refusal and the plugin's hooks.acorn8.18.0 becomes a direct devDependency; it was already in the lockfile.Behaviour
~/.local/share/maws-ascii/ast-equal.mjs). The comparison ignores positions,rawspellings, chunk hashes and the build-time stamp. It reads regex patterns with the introduced\uXXXXdecoded. It compares tagged templates' raw text exactly.cf3114da9) with this commit added: 248 byte-identical, 67 same AST, 0 differ.build.sourcemapat Vite'sfalse. No script passes--sourcemap. No.mapfile is emitted. Nothing undersrc/,scripts/orelectron-builder.ymlreads one: there is no--enable-source-maps,setSourceMapsEnabled,source-map-supportorprepareStackTrace. Turning maps on now fails the build with a message, rather than shipping maps that are silently wrong.NUMBERED,WORD,WIDE,MARKDOWN_LINK_INPUT_REGEX,MARKDOWN_LINK_PASTE_REGEX,xmlAttr,unicodeSubRegEx, a tiptapfind:rule and a control-character strip.exec,test,match,matchAllorreplace; none has its.sourceread.src/main/presentations/export.tssendsString(measureDeckPage)andString(shrinkScale)throughexecuteJavaScript. Both functions' text is byte-identical in the two builds.src/engine-host/fs/search-text.ts) is built from aString.rawtemplate that interpolatesisMadeUpFinalAnswer. The 66-line template and the function's text are both byte-identical.STAGE(...)is an untagged template, and its cooked value is unchanged.executeJavaScript,new Worker(…, { eval: true }),new Functionorvmsource-shipping site exists in main-process code.The target, checked directly
None of these files holds a character above U+00FF:
pnpm build:main-preload: 312 main files and 2 preloads.electron-vite dev's build: 314 files. This is main and the preloads built throughresolveConfig(…, 'serve', 'development'), the waycreateServerbuilds them, without starting Electron.build:helper, thenelectron-vite build, thenelectron-builder --mac dir. InMAWS.app/Contents/Resources/app.asar,out/main(312 files) is identical to the build, andout/preloadhas 2 files. The renderer is out of scope and still holds 69 such files.Memory
Method: the O3-D executor's. Each run reads V8 heap used after a forced GC (
--expose-gc,stats.cjson SIGUSR2). Master and head runs alternate on the MacBook, three runs each. Runs varied by under 12 KB.cf3114da9vs the same tree with this commitNotes on the table:
NODE_OPTIONS, so the engine host is started directly with the same arguments.Not done
zodand the MCP SDK fromnode_modules, and some of their files hold characters above U+00FF. In the asar, the affected zod files total 1.8 M characters and the SDK's 0.65 M, but only part of that is loaded. Rewritingnode_modulesat packaging time is a separate change.Gate
All runs are on head
b77354d50(treebc155c253).--gates all --class1a pool --runner macos. I cancelled it at 07:28Z to keep the Mac mini free for O3-D's booking. By then 40 jobs were green, no job had failed, and no flaky annotations had been recorded.--lane hosted. It coveredpackagedand the 13 groups the cancel stopped: library, agents, design, c7-utility, terminal, delivery, browser, presentations, design-systems, panel, browser-import, lane-a and connectors-direct. All green, with no flaky annotations.packaged:e2e:packaged213 passed and 239 skipped; supervisor packaged, daemon packaged and voice packaged each passed. Noflaky:line in the job log.--gates all --class1a pool --runner macos, launched at 10:01Z after the mini booking. Green on the first attempt: 51 jobs, 41 of them e2e groups, plus class 1a, unit:darwin and both e2e builds. No flaky annotations.packagedis not part ofall; its green run is 41020368991 above, on the same tree.An independent review (
doperpowers:reviewer-medium) oforigin/master..b77354d50had no material findings. It also checked the hash placeholders, acorn's script/module fallback and UTF-16 positions, and theelectron-vite devbuild, and ran the built presentation-measurement functions and search worker directly.Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)