Skip to content

Visual Flow Editor: граф логики, debugger и production runtime - #403

Merged
spacesarmat merged 26 commits into
mainfrom
feat/visual-flow-editor
Nov 13, 2026
Merged

spacesarmat merged 26 commits into
mainfrom
feat/visual-flow-editor

Conversation

@spacesarmat

@spacesarmat spacesarmat commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Что изменено

  • Добавлена типизированная FlowDocument со schemaVersion: 1, graph interpreter, validation и rebase по id без миграции старых документов.
  • Реализован desktop node canvas: узлы, связи output-input, pan/zoom/grid/minimap, multi-select, clipboard, каскадное размещение и typed inspector.
  • Добавлены debugger с mocks, breakpoints, step over/into, variables и trace diff, а также пять шаблонов потоков с выбором graph-правила.
  • Добавлены scoped export со структурным diff и production runtime для TV, phone и desktop. Production активируется только явным экспортом, generated module остаётся синхронизирован с merged flow после all/page/component export.
  • Preview, debugger и production используют общий interpreter. Legacy rules сохраняют приоритет, dispatcher остаётся синхронным, лимиты 32 steps и 16 timer flows. Произвольный JavaScript, HTTP и async interpreter не допускаются.
  • Editor screen names явно преобразуются в маршруты каждой платформы. Неподдерживаемые destinations возвращают понятную ошибку вместо перехода на settings.
  • Обновлены руководство пользователя, changelog и AGENTS.md.

Проверено

  • npm run test:editor: 59 файлов, 781/781 тест.
  • npx tsc --noEmit.
  • npm run build, npm run build:mobile, npm run build:desktop, npm run build:editor.
  • npm run editor:generate -- --check, git diff --check.
  • Независимые reviews по задачам, whole-branch review и scoped re-reviews исправлений.
  • Browser acceptance: создание и связывание узлов, inspector, clipboard, debugger с breakpoint, вставка шаблонов, переключение graph-правил, read-only и успешный export diff. Кнопка Экспортировать не нажималась.
  • Все 9 inline-замечаний Greptile исправлены и проверены независимым reviewer.

Скриншот

Visual Flow Editor

Ограничения

  • Node editor работает на desktop. Phone и TV используются как preview/production flows, устройства в этой проверке не запускались.
  • queue.add на phone возвращает документированную ошибку из-за отсутствия append-команды в player protocol.
  • TV paused/finished зависят от свежести bridge snapshot. download.failed не отличает удаление от потери.
  • restore-position является configurable example для variables/graph. Живой restore route/position/element не заявлен и требует отдельных typed adapters.
  • Полный npm test не запускался в Git Bash на Windows из-за требований Linux и Postgres 17. Стандартные CI jobs подтверждают полный набор на Linux.
  • Deploy, release и production export не выполнялись.

RetriggerView in GreptileConfidence Score: 4/5

The route-copy fix looks safe, but the earlier condition-editor issue still needs a complete fix before merging.

Fix All in CursorFindings

  1. P1 Typed comparisons cannot be edited ▶
Fix with agent prompt
### Issue 1
editor/src/components/FlowNodeInspector.tsx:undefined-125
Every `variable.*` condition gets a true/false editor, including number, string, and enum variables. Editing the string condition in `restore-position` writes a boolean and makes export fail with `WRONG_VALUE_TYPE`. Selecting a numeric operator also passes a boolean or string to the parser instead of a number. Choose the editor and starting value from the variable type and operator.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds a visual flow editor with typed graphs, templates, a debugger, scoped export, and a shared production runtime.

  • Flow rules can branch through typed nodes and run in the preview.
  • Desktop editor users can build flows and step through them with mock state.
  • Scoped exports show flow changes and generate code from the merged document.
  • Exported flows can respond to app events and call supported actions on each platform.
  • Project notes and release records now describe the visual flow editor.

Reviews (4) · Last reviewed commit: "fix: give every flow navigation its own ..." · Reviewed by Greptile

Inserted flow templates bind to the canvas screen so their rules are
visible and editable right away, a screen with several graph rules gets
a compact rule selector on the canvas, trigger elementId is editable in
the node inspector with schema-safe id validation, consecutive new nodes
cascade from the viewport center, and production timer intervals
dispatch their own rule instead of the first matching timer rule.
Comment thread mobile/src/productionFlowDispatcher.ts Resolved
const condition: InteractionCondition = step?.condition ?? defaultCondition();
const flat = condition.kind === 'all' || condition.kind === 'any' || condition.kind === 'not' || condition.kind === 'exists' ? undefined : condition;
const conditionPath = flat?.path ?? 'server.connected';
const isBooleanPath = BOOLEAN_PATHS.has(conditionPath) || conditionPath.startsWith('variable.');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Typed comparisons cannot be edited

Every variable.* condition gets a true/false editor, including number, string, and enum variables. Editing the string condition in restore-position writes a boolean and makes export fail with WRONG_VALUE_TYPE. Selecting a numeric operator also passes a boolean or string to the parser instead of a number. Choose the editor and starting value from the variable type and operator.

Prompt To Fix With AI
This is a comment left during a code review.
Path: editor/src/components/FlowNodeInspector.tsx
Line: 125

Comment:
**Typed comparisons cannot be edited**

Every `variable.*` condition gets a true/false editor, including number, string, and enum variables. Editing the string condition in `restore-position` writes a boolean and makes export fail with `WRONG_VALUE_TYPE`. Selecting a numeric operator also passes a boolean or string to the parser instead of a number. Choose the editor and starting value from the variable type and operator.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Cursor

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправлено в 1c23dde: редактор значения выбирается по FlowVariable.type и оператору. boolean, number, string и enum сохраняют правильные типы, numeric operators используют finite number. Добавлены tests для всех типов и restore-position string.

Comment thread editor/src/components/FlowCanvas.tsx Resolved
Comment thread design/flow-templates.ts Resolved
Comment thread design/flow-templates.ts Resolved
Comment thread design/production-flow.ts Resolved
Comment thread design/interaction.ts Resolved
- map editor routes to phone MRoute (search to add) and reject unsupported destinations instead of pushing them
- pick the condition value editor by variable type and operator and keep the path through exists
- start dialog actions with valid title and message so the draft parse cannot fail
- place new flow nodes at the viewport center for viewports offset from the page origin
- treat queue.add as fire-and-forget so episode chains reach playback.nextEpisode
- present restore-position as a configurable variables example, not a live restore
- rewrite design/generated/flow.ts from the full merged document on scoped exports
- run preview clicks through the shared interpreter with a mock typed dispatcher
- search opens the TV search screen (add) for navigate and openScreen
- screens that exist on the TV keep their name
- unsupported destinations return a documented error without touching the stack
- toInteractionTraces takes the flow document and re-attaches the matched legacy rule condition by rule id
- graph trace entries never receive an invented condition
- InteractionTrace.action and ExecutionTraceEntry.action use InteractionAction['type'] instead of string casts
- validate posted trace actions against the full InteractionAction union via INTERACTION_ACTION_TYPES
- keep rejecting arbitrary strings and keep the 20 character action limit
Comment thread mobile/src/productionFlowDispatcher.ts Resolved
- phone and TV screen maps returned shared route objects, so repeated visits to one screen aliased one stack entry
- nav keys the covered scroll by route identity and the TV keys rendered screens by routeKey
- clone the mapped route per navigation; queue.append identity semantics stay untouched
@spacesarmat

Copy link
Copy Markdown
Owner Author

@greptile review

@spacesarmat
spacesarmat merged commit b84071e into main Nov 13, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant