sim
sim copied to clipboard
improvement(hitl): add webhook notification and resume, add webhook block
Summary
Adds webhook block and webhook resume functionality to hitl block
Type of Change
- [x] New feature
Testing
Manual
Checklist
- [x] Code follows project style guidelines
- [x] Self-reviewed my changes
- [x] Tests added/updated and passing
- [x] No new warnings introduced
- [x] I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
The latest updates on your projects. Learn more about Vercel for GitHub.
Greptile Summary
- Adds a new webhook request block and tool to send HTTP requests with HMAC-SHA256 signing and standard webhook headers
- Enhances the human-in-the-loop block to expose
resumeEndpointAPI URLs alongside existing UI URLs for programmatic workflow resumption - Updates the resume page client with modernized styling using CSS variables and improved block identification using optional
blockIdfields
Important Files Changed
| Filename | Overview |
|---|---|
tools/http/webhook_request.ts |
New webhook tool with HMAC signature generation and webhook-specific headers; requires review for security implementation |
blocks/blocks/webhook_request.ts |
New webhook request block configuration with AI-powered payload generation and comprehensive webhook functionality |
app/api/resume/[workflowId]/[executionId]/[contextId]/route.ts |
Modified resume API endpoint to allow dashboard access without deployment validation; check authentication logic |
executor/handlers/human-in-the-loop/human-in-the-loop-handler.ts |
Exposes resume API endpoints in HITL block outputs for webhook-based resumption; verify proper endpoint exposure |
Confidence score: 4/5
- This PR introduces significant new webhook functionality with proper integration across the codebase but requires careful security review
- Score reflects well-structured implementation following established patterns, but deducted one point due to authentication bypass logic in resume endpoints and HMAC security implementation that needs verification
- Pay close attention to the webhook tool's HMAC signature generation and the resume API's authentication bypass logic for dashboard access
Sequence Diagram
sequenceDiagram
participant User
participant HumanInTheLoopBlock
participant NotificationTools
participant WebhookRequest
participant Database
participant ResumeAPI
participant PauseResumeManager
User->>HumanInTheLoopBlock: Execute workflow with HITL block
HumanInTheLoopBlock->>Database: Generate pause context and persist execution
HumanInTheLoopBlock->>HumanInTheLoopBlock: Generate resume URLs (UI and API)
HumanInTheLoopBlock->>NotificationTools: Execute notification tools with resume links
NotificationTools->>WebhookRequest: Send webhook with resume endpoint
WebhookRequest->>External Service: POST webhook payload with signature
External Service-->>WebhookRequest: Acknowledge webhook
HumanInTheLoopBlock-->>User: Return pause response with resume URLs
User->>ResumeAPI: POST resume with input data
ResumeAPI->>Database: Validate workflow access and pause context
ResumeAPI->>PauseResumeManager: Enqueue or start resume execution
PauseResumeManager->>Database: Update pause status to resuming
PauseResumeManager->>PauseResumeManager: Execute workflow from pause point
PauseResumeManager->>Database: Update execution status to completed
PauseResumeManager-->>ResumeAPI: Return execution result
ResumeAPI-->>User: Return resume confirmation