Experimental improved script - #8863
Merged
Merged
Conversation
Add an EventScript serializer (the inverse of the backend parser) and a filtered 'source view' so AI agents can read existing events in the exact syntax accepted by the event_script field of generate_events: - EventsScriptRenderer.js: renders events (all event types, condition trees with and/or/not/once, local variables, loop clauses) as EventScript, each event annotated with its id (# event-2.1). Code-only parameters and trailing empty values are dropped (the compilation refills them). - EventsScriptSourceView.js: filters (event_ids or group names, text search, object names - they compose), ancestors of selected events shown as header lines, skipped siblings as # ... markers, and a max_chars budget honored by collapsing sub-events first, then dropping trailing events (with a note listing their ids). - New read_scene_events_source editor function exposing this to AI agents, so an event can be fetched verbatim, edited and resent in full instead of being rebuilt from a summary (which could silently drop actions or sub-events when the agent only has a partial view). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzTSCY3P7LgWu19yQj7bx
… form v9 signals to the backend that this editor implements the read_scene_events_source function and can apply the two explicit replace relations of generate_events. Editors in production that send v8 keep the previous toolsets unchanged. The events source view also adds a note when the selection contains events that cannot be expressed as EventScript (like JavaScript code events, shown as # comments), warning against replacing a subtree containing them (they would be silently lost). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzTSCY3P7LgWu19yQj7bx
…rce anchor For replace placements of generate_events, the editor now computes the current EventScript source of the target event (its own lines, without sub-events) and sends it along the batch (placementTargetEventSource), next to the caller-provided expected_event_source anchor. The backend compares both (leniently) and rejects a replace whose anchor is missing or stale - proving the event was read and hasn't changed before being overwritten. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzTSCY3P7LgWu19yQj7bx
…h shared fixtures The renderer now runs the same conformance fixtures as the backend serializer (events-script-serializer.js in GDevelop-services): the same serialized events must render to the exact same EventScript on both sides. The fixtures file (EventsScriptRenderer.fixtures.json) is kept byte-identical with its copy in GDevelop-services - update both in the same change when the rendering evolves. Also cross-reference the backend counterpart (aligned function names and rendering rules) and the EventScript ecosystem README from the header. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzTSCY3P7LgWu19yQj7bx
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzTSCY3P7LgWu19yQj7bx
… bodies The events-editing capabilities (read_events_source, explicit replace relations with the expected_event_source anchor) now ship as tools v11 backend-side (v9 stays as production knows it, v10 is skipped): the editor declares v11 accordingly. The EventsScript renderer now always emits a `pass` body line for an event whose body renders empty, so a lone header (like `else if X:`) never looks like it owns the next non-indented line. The backend parser accepts and ignores `pass`, and its lenient comparisons drop it. Shared conformance fixtures updated (kept byte-identical with the backend copy). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzTSCY3P7LgWu19yQj7bx
The language is named EventScript: the renderer and source view files, functions (renderEventsAsEventScript, buildEventScriptSourceView...) and the read_events_source output field (eventScript) are renamed accordingly. read_events_source no longer misleads on empty results: a filter matching nothing or unresolved event_ids returns an explicit "the events sheet is NOT empty" note instead of "This scene has no events." (kept only for a truly empty sheet). selectedEventIds now reflects only the events actually shown when trailing events are dropped for size. Ancestor headers shown for context get a `# ...` marker when their own actions are hidden, and a selected `else` event gets a note explaining it binds to the `if` above. The anchor source sent with replace placements now covers exactly what the placement destroys: the event alone for replace_event_but_keep_existing_sub_events, the full subtree for replace_entire_event_and_sub_events - so a concurrently edited sub-event invalidates a whole-subtree replacement. The own source of an action-less event with sub-events now carries the explicit `pass` too. A freshly created repeat event (empty expression) renders as `repeat 0 times:` so every read source stays parseable; shared fixtures updated (byte-identical with the backend copy). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzTSCY3P7LgWu19yQj7bx
…call The proof-of-read reference sent with replace placements was rendered without a size bound, while the backend bounds the field: a subtree bigger than the read_events_source limit would have failed the whole request. Past that limit the reference is now omitted, so the replace proceeds without the check (like an editor without the capability) instead of failing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzTSCY3P7LgWu19yQj7bx
4ian
force-pushed
the
claude/eventscript-compilation-audit-so0n6h
branch
from
July 20, 2026 16:32
4b4a7ad to
050b5be
Compare
4ian
marked this pull request as ready for review
July 21, 2026 14:28
The buildEventScriptSourceView and renderEventSourceById tests move from EventScriptRenderer.spec.js to a dedicated EventScriptSourceView.spec.js, matching the module they test. The shared test helpers (makeEventsList and the scene start serialized events used by both suites) move to EventScriptTestHelpers.js. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzTSCY3P7LgWu19yQj7bx
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.
No description provided.