-
Notifications
You must be signed in to change notification settings - Fork 735
Feat/frontend node execution #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
reconsumeralization
wants to merge
4
commits into
raidendotai:main
Choose a base branch
from
reconsumeralization:feat/frontend-node-execution
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feat/frontend node execution #98
reconsumeralization
wants to merge
4
commits into
raidendotai:main
from
reconsumeralization:feat/frontend-node-execution
Conversation
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
[pull] main from raidendotai:main
This commit introduces the capability to trigger node execution from the frontend.
Key changes:
Backend (`cofounder/api/server.js`):
- Added a new API action `execute:node` handled by the `_executeNode` function.
- `_executeNode` implements:
- Extraction of `project_id`, `node_key`, and `input_parameters`.
- Resolution of placeholders in `input_parameters` (supports `{{workflow.input.X}}` and `{{data.node_id.output.path}}`).
- Dynamic determination of the system function/operation ID to call (defaults to `node_key`, with an override option).
- Execution of the target system function via `cofounder.system.run()`, passing resolved parameters and project context.
- JSON parsing for stringified `messages` parameter.
- Robust error handling and logging.
Frontend (`cofounder/dashboard/src/components/flow/nodes/cofounder-node.tsx`):
- Added a "Run" button to the node UI.
- Implemented UI for providing mock input parameters (text, model, messages) based on node type/key.
- The "Run" button calls the new `/api/project/actions` endpoint with `execute:node`.
- Enhanced your feedback with loading states on the "Run" button and toast notifications for success/error of the API call.
- Leverages existing stream handling for live updates during node execution.
Keymap Access:
- Analysis confirmed that backend keymap data is loaded from project storage. Synchronizing this with the frontend's `keymap.tsx` is an external process (manual or scripted build step).
This provides the core infrastructure for UI-driven node execution and complex parameterization. Further refinements to input definitions and comprehensive testing are recommended next steps.
This commit enhances the node input system by:
1. **Standardizing Input Definitions in `keymap.tsx`**:
* Introduced an `inputs` array within the `meta` property of node definitions in `cofounder/dashboard/src/components/flow/keymap.tsx`.
* Each input definition includes `name`, `label`, `type` ('text', 'textarea', 'json', 'number', 'boolean'), `defaultValue`, `placeholder`, `rows` (for textareas), and `required`.
* Updated `pm.details`, `pm.prd`, and `db.schemas` with example input definitions, including new 'number' and 'boolean' types for `pm.details`.
2. **Dynamic Frontend Input Rendering (`cofounder-node.tsx`)**:
* Removed previous hardcoded input logic.
* Nodes now dynamically render input fields (Label, Input, Textarea, Switch) based on the `inputs` array defined in their `meta` data.
* Supports 'text', 'textarea', 'json', 'number', and 'boolean' types.
* Input fields are pre-populated with `defaultValue` from the definitions.
* The `inputParams` state correctly captures your input from these dynamic fields.
This makes the node input system more flexible, maintainable, and extensible, allowing for easier configuration of node parameters directly from `keymap.tsx`.
This commit introduces support for a 'select' input type within the dynamic node input system.
Key changes:
1. **`keymap.tsx` Update (`cofounder/dashboard/src/components/flow/keymap.tsx`)**:
* I added an example 'select' input definition to the `pm.details` node for 'project_priority'.
* This definition includes an `options` array, where each option has a `value` and a `label`, and a `defaultValue` is specified.
2. **Frontend Rendering (`cofounder/dashboard/src/components/flow/nodes/cofounder-node.tsx`)**:
* The dynamic input rendering logic now handles `type: 'select'`.
* It uses the `Select`, `SelectTrigger`, `SelectValue`, `SelectContent`, and `SelectItem` components from `@/components/ui/select` to render the dropdown.
* Options are populated from the `inputDef.options` array in `keymap.tsx`.
* The component correctly binds to and updates the `inputParams` state, and respects the `defaultValue`.
This enhancement allows for dropdown select fields in node inputs, further increasing the flexibility and configurability of nodes through `keymap.tsx`.
Author
reconsumeralization
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You like it?
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.
This commit introduces the capability to trigger node execution from the frontend.
Key changes:
Backend (
cofounder/api/server.js):execute:nodehandled by the_executeNodefunction._executeNodeimplements:project_id,node_key, andinput_parameters.input_parameters(supports{{workflow.input.X}}and{{data.node_id.output.path}}).node_key, with an override option).cofounder.system.run(), passing resolved parameters and project context.messagesparameter.Frontend (
cofounder/dashboard/src/components/flow/nodes/cofounder-node.tsx):/api/project/actionsendpoint withexecute:node.Keymap Access:
keymap.tsxis an external process (manual or scripted build step).This provides the core infrastructure for UI-driven node execution and complex parameterization. Further refinements to input definitions and comprehensive testing are recommended next steps.