Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

waleedlatif1 and others added 3 commits January 6, 2026 15:01
* fix(build): fix type assertion

* ack PR comment

* more
* Add ports to router block

* Add tag dropdowns

* Fix lint

* fix tests + add context into block preview

---------

Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
* feat(combobox): added expression support to combobox

* fix chat messages styling in light mode

* last sec stuff

* ack comments
@vercel
Copy link

vercel bot commented Jan 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 7, 2026 0:03am

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 7, 2026

Greptile Summary

This PR bundles three changes:

  • Port-based Router Block (router_v2): Introduces a new routing mechanism that uses route definitions with natural language descriptions instead of relying on downstream block names. The LLM evaluates context against route descriptions to make routing decisions. The legacy router is preserved but hidden from the toolbar.

  • Combobox Expression Support: Enhanced the combobox component to accept expressions (like <block.output>) directly, store raw values when no matching option exists, and support async option fetching with hydration via fetchOptionById.

  • Type Assertion Fix: Corrected the ToolConfig.request.body type signature to include FormData and undefined return types, fixing build errors.

Confidence Score: 4/5

  • This PR is safe to merge with minor attention to combobox edge cases
  • The changes are well-structured and follow existing patterns. The router_v2 implementation mirrors the legacy router handler. Type fixes are straightforward. The combobox expression support adds complexity but handles edge cases reasonably.
  • Pay attention to combobox.tsx and condition-input.tsx for edge case handling

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx Added expression support, async fetchOptions, fetchOptionById for hydration, and dependency tracking. Allows storing raw values when no option matches (for expressions like <block.output>).
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/condition-input/condition-input.tsx Added mode prop to support both condition (code editor) and router (text input) modes. Router mode uses Textarea with tag/env var support instead of code editor.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx Added router_v2 block support with per-route handles, context row, and separate route rows with dynamic output handles per route.
apps/sim/blocks/blocks/router.ts Added RouterV2Block with port-based routing, generateRouterV2Prompt function, and helper functions. Legacy router hidden from toolbar.
apps/sim/executor/handlers/router/router-handler.ts Split execution into executeLegacy and executeV2 methods. V2 uses route definitions with descriptions for LLM-based routing.
apps/sim/tools/types.ts Updated body function signature in ToolConfig.request to include FormData and undefined return types.

Sequence Diagram

sequenceDiagram
    participant User
    participant WorkflowBlock
    participant ConditionInput
    participant RouterHandler
    participant ProviderAPI

    Note over User,ProviderAPI: Router V2 Flow (Port-based)
    
    User->>WorkflowBlock: Create router_v2 block
    WorkflowBlock->>ConditionInput: Render in router mode
    ConditionInput-->>User: Display route textareas
    User->>ConditionInput: Define route descriptions
    
    Note over RouterHandler: Execution Phase
    RouterHandler->>RouterHandler: parseRoutes(inputs.routes)
    RouterHandler->>RouterHandler: generateRouterV2Prompt(context, routes)
    RouterHandler->>ProviderAPI: POST /api/providers
    ProviderAPI-->>RouterHandler: Selected route ID
    RouterHandler->>RouterHandler: Find connection by router-{routeId} handle
    RouterHandler-->>WorkflowBlock: Execute target block
Loading

@waleedlatif1 waleedlatif1 merged commit bfb6fff into main Jan 7, 2026
25 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.

3 participants