gupta-sahil01 opened a new pull request, #6437:
URL: https://github.com/apache/texera/pull/6437
Frontend half of the ambient operator recommender (apache/texera#5240).
After an operator is added to the canvas, 1-3 faded "ghost" next-operator
suggestions appear on its output port; clicking one materializes the operator
and wires the link as a single undoable action.
- OperatorRecommendationService: calls the stateless agent-service POST
/api/recommend endpoint and turns a chosen suggestion into a real operator.
Fails soft — a disabled feature, an output-less operator, or a backend error
simply yields no suggestions, leaving the canvas unchanged.
- Ghost overlay in the workflow editor, reusing the chat-popover anchoring
pattern (screen-coord conversion, re-anchored on move / zoom / pan); dismissed
on blank click or when the anchor operator is deleted.
- Opt-in GUI config flag `operatorRecommendationEnabled`, default off,
threaded through gui.conf, GuiConfig, ConfigResource, and the frontend
GuiConfig type + mock.
Tested: yarn ng test (operator-recommendation.service.spec.ts, 7 passed);
yarn ng build --configuration=production (succeeds, no errors).
<!--
Thanks for sending a pull request (PR)! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
[Contributing to
Texera](https://github.com/apache/texera/blob/main/CONTRIBUTING.md)
2. Ensure you have added or run the appropriate tests for your PR
3. If the PR is work in progress, mark it a draft on GitHub.
4. Please write your PR title to summarize what this PR proposes, we
are following Conventional Commits style for PR titles as well.
5. Be sure to keep the PR description updated to reflect all changes.
-->
### What changes were proposed in this PR?
Frontend half (PR 2 of 2) of the ambient operator recommender, Version 1 —
see #6293 (design discussion #5240). Depends on the backend `/api/recommend`
endpoint added in the companion backend PR.
After an operator is added to the canvas, 1–3 faded "ghost" next-operator
suggestions appear on its output port; clicking one materializes that operator
and wires the link as a single undoable action. Behaves like code-completion
ghost text, but for dataflow graphs. **Opt-in and default-off.**
- **`OperatorRecommendationService`** calls `POST /api/recommend` and
materializes a chosen suggestion. Fails soft: a disabled feature, an
output-less operator (e.g. a chart sink), or a backend error all yield no
suggestions and leave the canvas unchanged.
- **Ghost overlay** in the workflow editor, reusing the existing
chat-popover anchoring pattern (screen-coord conversion; re-anchored on
operator move / zoom / pan); dismissed on blank click or when the anchor
operator is deleted.
- **Opt-in flag** `operatorRecommendationEnabled` (default `false`),
threaded through `gui.conf` → `GuiConfig` → `ConfigResource` → the frontend
`GuiConfig` type + mock.
- **Routing** for the endpoint added to the dev proxy
(`frontend/proxy.config.json`) and the prod gateway
(`bin/k8s/.../gateway-routes.yaml`), alongside the existing `/api/agents`.
<!--
Please clarify what changes you are proposing. The purpose of this section
is to outline the changes. Here are some tips for you:
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
3. If it is a refactoring, clarify what has been changed.
3. It would be helpful to include a before-and-after comparison using
screenshots or GIFs.
4. Please consider writing useful notes for better and faster reviews.
-->
### Any related issues, documentation, discussions?
- Closes #6293
- Design discussion: #5240
<!--
Please use this section to link other resources if not mentioned already.
1. If this PR fixes an issue, please include `Fixes #1234`, `Resolves
#1234`
or `Closes #1234`. If it is only related, simply mention the issue
number.
2. If there is design documentation, please add the link.
3. If there is a discussion in the mailing list, please add the link.
-->
### How was this PR tested?
- `yarn ng test` — `operator-recommendation.service.spec.ts`, 7 passed
(enabled/disabled gating, POST body, empty-list fallbacks on error and
output-less operators, materialize link wiring).
- `yarn ng build --configuration=production` — succeeds under strict
templates.
- **End-to-end (manual):** ran the full local-dev stack with
`GUI_WORKFLOW_WORKSPACE_OPERATOR_RECOMMENDATION_ENABLED=true`; verified ghost
suggestions render on the output port, clicking materializes + links the
operator, and `POST /api/recommend` is reached through the proxy.
<!--
If tests were added, say they were added here. Or simply mention that if the
PR
is tested with existing test cases. Make sure to include/update test cases
that
check the changes thoroughly including negative and positive cases if
possible.
If it was tested in a way different from regular unit tests, please clarify
how
you tested step by step, ideally copy and paste-able, so that other
reviewers can
test and check, and descendants can verify in the future. If tests were not
added,
please describe why they were not added and/or why it was difficult to add.
-->
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Anthropic Claude (Claude Code)
<!--
If generative AI tooling has been used in the process of authoring this PR,
please include the phrase: 'Generated-by: ' followed by the name of the tool
and its version. If no, write 'No'.
Please refer to the [ASF Generative Tooling
Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]