-
Notifications
You must be signed in to change notification settings - Fork 86
Triggers #1468
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
base: main
Are you sure you want to change the base?
Triggers #1468
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @amikofalvy's task —— View job Staff Engineer Review: Triggers Feature ImplementationI've completed a comprehensive review of this substantial triggers feature implementation. This adds webhook-based agent invocation capabilities with authentication, payload transformation, and audit logging. Below are my key findings and recommendations. 🎯 Feature OverviewThe implementation successfully delivers a webhook trigger system allowing external services to invoke agents. The feature includes input validation, payload transformation, multiple authentication methods, and comprehensive audit logging. The PRD indicates ~70% completion with core infrastructure complete but missing agent invocation integration.
|
- Added triggers table with fields: id, tenantId, projectId, agentId, name, description, enabled, inputSchema, outputTransform, messageTemplate, authentication, signingSecret, timestamps - Added trigger_invocations table with fields: id, tenantId, projectId, agentId, triggerId, conversationId, status, requestPayload, transformedPayload, errorMessage, createdAt - Added foreign key constraints with cascade delete - Updated prd.json with real user stories from ralph/prd.json Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Marked US-001 and US-002 as complete in prd.json - Added iteration 4 details to progress.txt with implementation summary Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Added TriggerAuthenticationSchema with discriminated union for api_key, basic_auth, bearer_token, none - Added TriggerOutputTransformSchema with jmespath and objectTransformation fields - Added TriggerInvocationStatusEnum with pending, success, failed values - Added TriggerSelectSchema, TriggerInsertSchema, TriggerUpdateSchema - Added TriggerApiSelectSchema, TriggerApiInsertSchema, TriggerApiUpdateSchema - Added TriggerInvocationSelectSchema, TriggerInvocationInsertSchema, TriggerInvocationUpdateSchema - Added TriggerInvocationApiSelectSchema, TriggerInvocationApiInsertSchema, TriggerInvocationApiUpdateSchema - All schemas follow existing pattern with agent-scoped API schemas - Typecheck passes Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Created triggers.ts with CRUD operations: getTriggerById, listTriggers, listTriggersPaginated, createTrigger, updateTrigger, deleteTrigger - Created triggerInvocations.ts with operations: getTriggerInvocationById, listTriggerInvocationsPaginated (with status and date filtering), createTriggerInvocation, updateTriggerInvocationStatus - All functions follow agent-scoped pattern with curried database client - Exported from data-access/index.ts - Added TriggerSelect, TriggerInsert, TriggerUpdate types to entities.ts - Added TriggerInvocationSelect, TriggerInvocationInsert, TriggerInvocationUpdate types to entities.ts - Typecheck passes Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- 6/26 user stories completed (23%) - Core database and data access foundation complete - Ready for webhook endpoint implementation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implements authentication verification, signing secret verification, and message template interpolation for trigger webhooks. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Extended triggers.test.ts with comprehensive invocation history endpoint tests (300+ additional lines) - Added helper function createTestInvocation() to create test invocation records directly in database - Implemented test coverage for GET /:triggerId/invocations endpoint: - List invocations with pagination (empty state, multiple invocations, pagination metadata) - Ordering by createdAt DESC (newest first) - verified with different timestamps - Status filtering (success, failed, pending) - Date range filtering with from parameter - Date range filtering with both from and to parameters - Pagination handling (5 items, page 1, limit 3) - Implemented test coverage for GET /:triggerId/invocations/:invocationId endpoint: - Get single invocation by ID - 404 for non-existent invocation - Tenant isolation (cross-tenant access returns 404) - Error message inclusion for failed invocations - All tests verify response structure and exclude sensitive fields (tenantId, projectId, agentId) - Tests use direct database access via createTriggerInvocation() from agents-core - Follows existing integration test patterns with proper tenant isolation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Created Trigger class in packages/agents-sdk/src/trigger.ts (110 lines) - Implemented TriggerInterface with getId(), getName(), getConfig(), with() methods - Added support for Zod schema conversion in inputSchema (converts to JSON Schema) - Implemented with() method for creating customized trigger variants - Created trigger() builder function in builderFunctions.ts - Added comprehensive JSDoc with GitHub webhook example - Exported Trigger class and trigger() function from SDK index - Follows existing SDK patterns (Tool, DataComponent, ArtifactComponent) - Handles null inputSchema properly (converts to undefined) - Auto-generates ID from name if not provided using generateIdFromName() - No init() or upsert() methods needed (triggers managed via manage-API) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Added triggers?: () => TriggerInterface[] to AgentConfig type - Added getTriggers(): Record<string, Trigger> method to Agent class - Added addTrigger(...triggers: TriggerInterface[]) method to Agent class - Resolves triggers lazily using existing resolveGetter() helper - Added trigger count to agent creation logging - Exported TriggerInterface from types.ts for external use Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Added triggers field to AgentWithinContextOfProjectSchema as optional record - Implemented triggers serialization in Agent.toFullAgentDefinition() - Converts Zod inputSchema to JSON Schema during serialization - Includes triggers in agent definition when present - Typecheck passes for both agents-core and agents-sdk Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Marked US-022 as complete in prd.json - Added detailed progress log entry documenting implementation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Exported TriggerConfig type from trigger.ts (renamed from TriggerConfigWithZod) - Added TriggerConfig to SDK index.ts exports - SDK trigger serialization matches TriggerApiInsert in agents-core - Zod inputSchema conversion to JSON Schema already handled correctly - Typecheck passes Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Marked US-023 as complete in prd.json - Added detailed progress log entry documenting implementation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added comprehensive final summary documenting: - This session: completed US-022 and US-023 (SDK serialization and type exports) - Overall progress: 23/26 stories complete (88%) - Complete backend and SDK implementation - Remaining: 3 UI stories (out of scope for this loop) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Created triggers management page at /agents/[agentId]/triggers - Added TriggersTable component with inline enable/disable toggle - Added copy webhook URL button - Added delete trigger action with confirmation - Created triggers API client and server actions - Added Triggers button to agent toolbar for easy navigation - Exported TriggerApiInsert/Select/Update schemas from agents-core client-exports All acceptance criteria for US-024 met: - List view showing all triggers (name, enabled status, webhook URL) - Copy webhook URL button functional - Toggle enabled/disabled status inline - Typecheck passes Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- data-access-layer.md: Documents DAL patterns, scoping, and usage - database-architecture.md: Documents dual-database architecture (DoltGres + PostgreSQL)
Database architecture:
- Move triggerInvocations table from manage DB to runtime DB
- Invocations are transactional runtime data, not versioned config
- Update migrations for both manage and runtime schemas
API changes:
- Update manage-api trigger routes to use runtime DB for invocations
- Update run-api webhooks to write invocations to runtime DB
- Add proper cross-database query handling
UI fixes:
- Fix View conversation link to point to /traces/conversations/{id}
- Update invocations table and trigger form components
Other:
- Update permissions, validation schemas, and entity types
- Update SDK trigger and agent builder functions
- Add/update tests for new architecture
Conversation traces show no data (AI calls, timing, activity timeline) even when agent execution succeeds. This is likely due to OpenTelemetry tracing not being properly configured or SigNoz not running.
No description provided.