web: SvelteKit studio — editor, run, ops, regex, saved #10
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/web"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What changed
Scaffolds
web/(SvelteKit 3 + Svelte 5 runes +@xyflow/svelte1.7) and addsdeploy/web.Dockerfile. 41 files, no touches outsideweb/+deploy/web.Dockerfile.web/src/app.css): tokens copied verbatim fromdocs/design.md; hairline panels, bracketed[ OP ]controls, inversion-as-selection, uppercase underscored headers, one accent (--accentgreen),--dangeronly for destructive actions, blinking-pulse unsaved dot, ASCII empty states. No component library, no light mode.statenode (initial→glyph, accepting states get a real double border echoingperipheries=2, trace highlighting in accent) and a customterminaledge that handles self-loops (the default bezier degenerates when source == target, and the CONTRACT example FA hasq0 -a-> q0). Drag positions →layout. New transitions: drag handle → handle creates a dashed pending edge; the first symbol commits it. Inspector handles rename / initial (exactly one) / accepting toggles / per-symbol transition editing / deletion. Sidebar: alphabet editor (usage-aware delete with confirm), run panel, inspector.POST /run→ trace as TUI lines (> a → {q0, q1}), step buttons + click-to-step, active states highlighted on the canvas,[ ACCEPTED ]/[ REJECTED ]verdict on the final step.to-dfa/minimize/complement(the latter two pre-checked client-side against the mirrored determinism rule →NOT A DFA: … run [ TO-DFA ] first), andunion/intersection/difference/concatwith operand B picked from saved automata or pasted JSON. Results can be loaded into the editor (dirty-guard confirm) or saved as new./regex/to-nfaand/regex/from-fa, syntax hint line, result load/save/copy.AutomatonSummary), load / overwrite-row-with-current / delete, save-as-new + overwrite-current, all dirty-guarded. Payloads are{ name, data: { fa, layout } }per CONTRACT.src/lib/api/client.ts): thin fetch wrapper over the generatedschema.d.ts; the error envelope is decoded intoApiErrorand every panel renders it in a terminal error line — engine endpoints returning 501 show up as clean[ ERROR ] …lines, the UI is built against the contract, not a backend.MODE: DFA/NFA/EMPTY(mirrorsdeterminism_violationclient-side, violation shown as tooltip),Σ, state/transition counts, doc name + unsaved pulse dot, dim hints. Top bar tabsEDITOR / OPS / REGEX / SAVED+USER:from/me.Semantic decisions
@sveltejs/adapter-node(not static).ssr = false(canvas app). The deciding factor: a server hook (src/hooks.server.ts) that, whenAPI_UPSTREAMis set, forwards/api,/api-docs,/healthz,/readyzto it with paths preserved — so the compose stack needs no extra proxy container: When unset (k8s/prod), requests fall through to the SPA and Traefik routes api paths directly — same contract as the vite dev proxy. The env var is declared the Kit 3 way insrc/env.ts. Forwarding was tested against a stub api (GET/POST bodies intact; upstream-down → contract-shaped502 {"error":{...}}).$lib/svelte.config.js— imports use package.json subpath imports (#lib/...) with explicit extensions (#lib/state/editor.svelte.ts), config lives invite.config.ts, hooks typing imports from@sveltejs/kit/hooks./api,/api-docs,/healthz,/readyz→http://localhost:8080(bun run previewinherits it).transitionsalways serialized by the frontend (schema-legal, core-legal). Wire arrays are kept sorted client-side.[ RENDER ]toolbar action → modal with the SVG +FAST/LATEXengine buttons (latex expected to 503 until the render agent's image ships texlive).oven/bun:1.4.2-debianbuild stage (bookworm, matchingdeploy/api.Dockerfile's pinning style — note there is no1.4.2-bookwormtag), lockfile-frozen install, node_modules pruned to production deps,node:22-bookworm-slimruntime,PORT=3000. Build context isweb/per the.dockerignorenote.Closes #2. Related: #5 (ε wire representation question — the UI treats symbols as opaque strings, displays
""asε, so any core decision renders fine;/regex/to-nfaoutput must stayvalidate()-clean to be loadable back into the editor).Gate results
bun run check(svelte-check): 0 errors, 0 warningsbun run build(adapter-node): greendocker build -f deploy/web.Dockerfile web/: green (image boots, serves the SPA, forwards api paths)Engine endpoints currently 501 — run/ops/regex flows will show
[ ERROR ] …lines until the engine PR lands; nothing in the UI depends on a live backend.Acceptance walkthrough (once engine + api merge)
Load
[ EXAMPLE ](the CONTRACT example FA) → runaabbwith trace → step through snapshots → ops tabTO-DFA→MINIMIZE→ load into editor →[ RENDER ](fast) → saved tab[ SAVE AS NEW ]→ reload via[ LOAD ].