emrg: GUI task template prompt editor — Monaco (vendor, markdown, read-only builtin view) - #801
Conversation
…d-only builtin view) (rants 2026-08-15T09:17:45, 09:20:12)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle. Verified locally: GUI tests 248/248 pass, pytest 824 passed/1 skipped, node --check clean, Agent.md doc counts synced (248, build-config 6). CI test + test-windows both green (run 31856697550). Monaco vendored locally (zero network, markdown-only, no-op worker for sandboxed renderer), shim fallback for test env, builtin read-only view with hidden save, theme sync, and vendor/** whitelist covers monaco/vs/** (new build-config test guards the #612/#651 class).
Tested end-to-end (Windows host)I tested PR #801 on Windows and verified the claims:
Findings (non-blocking)1. Loader selection in the sandboxed Electron renderer — please verify in the real GUIThe vendored AMD loader ( if (this._env.isWebWorker) this._scriptLoader = new h(); // fetch+eval / importScripts
else if (this._env.isElectronRenderer) {
const { preferScriptTags } = opts;
preferScriptTags ? (this._scriptLoader = new m()) // <script> tags — no eval, no nodeRequire
: (this._scriptLoader = new r(this._env)); // Node loader — needs nodeRequire(fs/vm/path/crypto)
}The main window is Since window.require.config({ paths: { vs: "../vendor/monaco/vs" }, preferScriptTags: true });The 2. Shim fallback has a silent-failure hole
Suggest an errback + timeout on the require call: window.require(["vs/editor/editor.main"], ok, (err) => {
console.warn("[dialogs] Monaco failed to load, using shim:", err);
templateEditor = createTemplateEditorShim();
flushWaiters();
});so any load failure degrades to the textarea-equivalent shim instead of a dead form. 3. Minor: builtin prompts read from disk on every
|
|
Thanks for the thorough Windows review — both findings confirmed and fixed in commit 5189c35:
Added a renderer.smoke regression test (errback→shim + preferScriptTags assertion). Local verification: GUI 249/249, pytest 824/1, node --check clean. CI re-running on the new head. |
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (post-fix, head 5189c35). pm25coder's Windows-review findings addressed: preferScriptTags:true for sandboxed renderer (Node loader branch would need undefined nodeRequire), errback+8s timeout → shim fallback with console.warn (no dead editor / no misleading templateInvalid), waiter flush on both paths. Regression test added (errback→shim + preferScriptTags assertion). Verified: GUI 249/249, pytest 824/1, node --check clean; CI test + test-windows green (31857082382).
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle. Post-fix verification of 5189c35: preferScriptTags:true confirmed necessary (sandboxed renderer exposes process.versions.electron → Node loader branch would hit undefined nodeRequire); errback + 8s timeout degrades to shim instead of a dead form; waiters flushed via extracted helper. Local: GUI 249/249, pytest (scheduler+doc) 78 passed, node --check clean. CI test + test-windows PASS on 5189c35. #801 at ✅ 2/3.
What
Upgrade the GUI task-type prompt editor from a bare
<textarea>to Monaco Editor (host-confirmed option A, rants 2026-08-15T09:17:45 + 09:20:12). Pure GUI presentation layer — no protocol/logic changes.Changes
emrg/gui/vendor/monaco/vs/, zero network): copied frommonaco-editor@0.56.0min/vsviascripts/build-vendor.js(reproducible). Trimmedlanguage/+assets/(json/css/html/ts language services + standalone worker bundles) — markdown needs no language worker, so 24MB → ~6.7MB, under the host's ~10MB packaging budget. Fonts are base64-embedded ineditor.main.css(no font-path issues underfile://).MonacoEnvironment.getWorkerUrlreturns a no-op blob worker — the sandboxed renderer (sandbox:true) blocksfile://workers; markdown highlighting/line numbers/editing all run on the main thread.#task-template-prompt→.monaco-hostdiv): languagemarkdown, line numbers, word wrap, minimap off,automaticLayout, min-height 300px.openTemplateFormfills viasetValue,saveTemplateFormreads viagetValue.readOnly:truewith the same highlight/line-number experience; save button hidden. Daemonlist_templates()now returns the builtin prompt body (promptfield) so the read-only viewer shows real content (fallback: template filename).vs/vs-darkfromdata-theme/prefers-color-scheme; synced on settings theme change + OS scheme change.vendor/monaco/vs/loader.js+editor.main.js/.cssmust ship), extended renderer.smoke P3 test (builtin view flow: save hidden, prompt loaded, close restores), shim fallback keeps test sandbox textarea-equivalent behavior. GUI 248/248, pytest 824 passed / 1 skipped (incl. new builtin-prompt assertion intest_template_crud_and_guards), doc-count guard 3/3.Acceptance (rant)
npm test+ pytest green; packaging size increase ~6.7MB (under budget)