refactor(tool-input): subblock-first rendering, component extraction, bug fixes#3207
refactor(tool-input): subblock-first rendering, component extraction, bug fixes#3207waleedlatif1 wants to merge 7 commits intostagingfrom
Conversation
…d dependsOn gating Replace 17+ individual SyncWrapper components with a single centralized ToolSubBlockRenderer that bridges the subblock store with StoredTool.params via synthetic store keys. This reduces ~1000 lines of duplicated wrapper code and ensures tool-input renders subblock components identically to the standalone SubBlock path. - Add ToolSubBlockRenderer with bidirectional store sync - Add basic/advanced mode toggle (ArrowLeftRight) using collaborative functions - Add dependsOn gating via useDependsOnGate (fields disable instead of hiding) - Add paramVisibility field to SubBlockConfig for tool-input visibility control - Pass canonicalModeOverrides through getSubBlocksForToolInput - Show (optional) label for non-user-only fields (LLM can inject at runtime) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…canonical toggle, extract components - Attach resolved paramVisibility to subblocks from getSubBlocksForToolInput - Add labelSuffix prop to SubBlock for "(optional)" badge on user-or-llm params - Fix folder selector missing for tools with canonicalParamId (e.g. Google Drive) - Fix canonical toggle not clickable by letting SubBlock handle dependsOn internally - Extract ParameterWithLabel, ToolSubBlockRenderer, ToolCredentialSelector to components/tools/ - Extract StoredTool interface to types.ts, selection helpers to utils.ts - Remove dead code (mcpError, refreshTools, oldParamIds, initialParams) - Strengthen typing: replace any with proper types on icon components and evaluateParameterCondition
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR successfully replaces the ~440-line SyncWrapper system with a cleaner Key improvements:
Architecture: Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant TI as ToolInput
participant TSR as ToolSubBlockRenderer
participant SB as SubBlock
participant Store as SubBlockStore
participant Tool as StoredTool.params
TI->>TI: getSubBlocksForToolInput(toolId)
Note over TI: Filter subblocks by paramVisibility,<br/>conditions, canonical mode
loop For each filtered subblock
TI->>TSR: Render with effectiveParamId
TSR->>TSR: Create synthetic store ID
Note over TSR: syntheticId = subBlockId-tool-toolIndex-paramId
TSR->>Store: useSubBlockValue(blockId, syntheticId)
TSR->>Tool: Read tool.params[paramId]
Note over TSR: Bidirectional sync with refs<br/>to prevent echo loops
TSR->>TSR: Compute labelSuffix for (optional)
TSR->>SB: Render with config + labelSuffix
SB->>Store: User changes value
Store->>TSR: storeValue updated
TSR->>Tool: onParamChange(toolIndex, paramId, value)
Tool->>TSR: tool.params[paramId] changed
TSR->>Store: setStoreValue(newValue)
end
|
.../components/editor/components/sub-block/components/tool-input/components/tools/parameter.tsx
Show resolved
Hide resolved
...ts/editor/components/sub-block/components/tool-input/components/tools/sub-block-renderer.tsx
Show resolved
Hide resolved
…evant in tool input, and removed unused param
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| 'messages-input', | ||
| 'router-input', | ||
| 'text', | ||
| ]) |
There was a problem hiding this comment.
Workflow tool input mapping UI lost in subblock-first path
Medium Severity
When a workflow is added as an agent tool, the inputMapping parameter UI disappears. The WorkflowInputBlock has two subblocks: workflowId (type workflow-selector) and inputMapping (type input-mapping). Since input-mapping is in EXCLUDED_SUBBLOCK_TYPES, getSubBlocksForToolInput filters it out — but workflowId passes through, making useSubBlocks truthy. The subblock-first rendering path then only renders displaySubBlocks (just workflowId) and returns, so the fallback path containing the workflow-input-mapper case in renderParameterInput is never reached. Users lose the ability to pre-configure workflow input mappings in the tool-input context.
Additional Locations (1)
The SubBlock-first rendering path was hard-returning after rendering subblocks, so tool params without matching subblocks (like inputMapping for workflow tools) were never rendered. Now renders subblocks first, then any remaining displayParams not covered by subblocks via the legacy ParameterWithLabel fallback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
After redeploying a child workflow via the stale badge, the workflow state cache was not invalidated, so WorkflowInputMapperInput kept showing stale input fields until page refresh. Now invalidates workflowKeys.state on deploy success. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tional) spacing - Set workflowId param to user-only in workflow_executor tool config so "Select Workflow" no longer shows "(optional)" indicator - Tighten (optional) label spacing with -ml-[3px] to counteract parent Label's gap-[6px], making it feel inline with the label text Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>


Summary
ToolSubBlockRendererthat delegates to<SubBlock>for full rendering paritylabelSuffixprop on SubBlockcanonicalParamId(e.g. Google Drive list files)ParameterWithLabel,ToolSubBlockRenderer,ToolCredentialSelectortocomponents/tools/StoredTooltotypes.ts, selection helpers toutils.tsany)Type of Change
Testing
tsc --noEmit— zero errorsChecklist