-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(copilot): deprecate yaml, json import/export, deprecate build_workflow tool, convert copilot to json-based #1488
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
Conversation
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.
Greptile Overview
Summary
This PR successfully deprecates YAML import/export functionality and the build_workflow tool, converting the copilot system to JSON-based operations. The changes include:
- Tool Deprecation: Removed
build_workflowtool from copilot registry and server router - API Endpoints: Deprecated multiple YAML-related API routes (
/api/yaml/*,/api/workflows/yaml/*) - Format Conversion: Updated workflow text editor to support JSON-only, removing YAML/JSON dual mode
- Export System: Converted export controls from YAML to JSON using new workflow JSON store
- Training Logic: Updated training data processing to work with JSON operations instead of YAML
- Data Structures: Modified stores and utilities to work with
CopilotWorkflowStateformat
The conversion is comprehensive but introduces some complexity in YAML parsing utilities where both nested and direct handle formats are now supported, which could lead to conflicts.
Confidence Score: 4/5
- This PR is safe to merge with one logical issue that should be addressed
- The conversion from YAML to JSON is well-executed with clean removal of deprecated functionality. However, the YAML parsing utilities now support both nested ('loop.start') and direct ('loop-start-source') formats without conflict resolution, which could cause issues if both are used together.
- Pay attention to
apps/sim/stores/workflows/yaml/parsing-utils.tsfor potential format conflicts
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/lib/copilot/registry.ts | 5/5 | Updated tool registry to remove deprecated build_workflow tool, properly maintains type safety with zod schemas |
| apps/sim/lib/copilot/tools/server/router.ts | 5/5 | Cleanly removed build_workflow tool registration and validation logic |
| apps/sim/stores/workflows/json/store.ts | 5/5 | New JSON workflow store implementation with proper sanitization and export functionality |
| apps/sim/stores/workflows/yaml/parsing-utils.ts | 3/5 | Added direct handle format support for loop and parallel connections, potential duplication with existing nested format logic |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-text-editor/workflow-text-editor.tsx | 4/5 | Properly converted from YAML/JSON dual support to JSON-only, removed format conversion logic |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/control-bar/components/export-controls/export-controls.tsx | 5/5 | Clean conversion from YAML export to JSON export using new workflow JSON store |
Sequence Diagram
sequenceDiagram
participant User
participant CopilotChat as Copilot Chat API
participant SimAgent as Sim Agent
participant WorkflowStore as Workflow Store
participant JsonStore as JSON Store
participant TrainingAPI as Training API
Note over User, TrainingAPI: Before: YAML-based workflow operations
User->>CopilotChat: Send message with workflow context
CopilotChat->>SimAgent: Forward with workflow data
SimAgent->>SimAgent: Use build_workflow tool (deprecated)
SimAgent-->>CopilotChat: YAML workflow response
CopilotChat-->>User: YAML-based response
Note over User, TrainingAPI: After: JSON-based workflow operations
User->>CopilotChat: Send message with workflow context
CopilotChat->>SimAgent: Forward with JSON workflow data
SimAgent->>SimAgent: Use edit_workflow tool (JSON-based)
SimAgent->>WorkflowStore: Update workflow state
WorkflowStore->>JsonStore: Generate JSON export
SimAgent-->>CopilotChat: JSON workflow response
CopilotChat-->>User: JSON-based response
User->>TrainingAPI: Submit training data
TrainingAPI->>TrainingAPI: Process JSON operations
TrainingAPI->>TrainingAPI: Send to agent indexer
57 files reviewed, 1 comment
|
|
||
| // Parse direct handle formats (alternative to nested format) | ||
| // This allows using 'loop-start-source' directly instead of 'loop.start' | ||
| if (connections['loop-start-source']) { | ||
| const targets = Array.isArray(connections['loop-start-source']) | ||
| ? connections['loop-start-source'] | ||
| : [connections['loop-start-source']] | ||
| targets.forEach((target) => { | ||
| if (typeof target === 'string') { | ||
| edges.push(createEdge(blockId, target, 'loop-start-source', 'target')) | ||
| } else { | ||
| errors.push(`Invalid loop-start-source target in block '${blockId}': must be a string`) | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| if (connections['loop-end-source']) { | ||
| const targets = Array.isArray(connections['loop-end-source']) | ||
| ? connections['loop-end-source'] | ||
| : [connections['loop-end-source']] | ||
| targets.forEach((target) => { | ||
| if (typeof target === 'string') { | ||
| edges.push(createEdge(blockId, target, 'loop-end-source', 'target')) | ||
| } else { | ||
| errors.push(`Invalid loop-end-source target in block '${blockId}': must be a string`) | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| if (connections['parallel-start-source']) { | ||
| const targets = Array.isArray(connections['parallel-start-source']) | ||
| ? connections['parallel-start-source'] | ||
| : [connections['parallel-start-source']] | ||
| targets.forEach((target) => { | ||
| if (typeof target === 'string') { | ||
| edges.push(createEdge(blockId, target, 'parallel-start-source', 'target')) | ||
| } else { | ||
| errors.push(`Invalid parallel-start-source target in block '${blockId}': must be a string`) | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| if (connections['parallel-end-source']) { | ||
| const targets = Array.isArray(connections['parallel-end-source']) | ||
| ? connections['parallel-end-source'] | ||
| : [connections['parallel-end-source']] | ||
| targets.forEach((target) => { | ||
| if (typeof target === 'string') { | ||
| edges.push(createEdge(blockId, target, 'parallel-end-source', 'target')) | ||
| } else { | ||
| errors.push(`Invalid parallel-end-source target in block '${blockId}': must be a string`) | ||
| } | ||
| }) | ||
| } |
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.
logic: Adding direct handle format parsing (e.g. 'loop-start-source') alongside existing nested format ('loop.start') could lead to conflicts if both formats are used in the same workflow YAML. Consider validating that only one format is used per block or document precedence rules.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/stores/workflows/yaml/parsing-utils.ts
Line: 569:622
Comment:
logic: Adding direct handle format parsing (e.g. 'loop-start-source') alongside existing nested format ('loop.start') could lead to conflicts if both formats are used in the same workflow YAML. Consider validating that only one format is used per block or document precedence rules.
How can I resolve this? If you propose a fix, please make it concise.
Summary
Deprecate yaml, json import/export, deprecate build_workflow tool, convert copilot to json-based
Fixes #(issue)
Type of Change
Testing
Manual
Checklist