Skip to content

Conversation

@reconsumeralization
Copy link

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.

reconsumeralization and others added 4 commits May 21, 2025 23:09
[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`.
Copy link
Author

@reconsumeralization reconsumeralization left a 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant