External trigger cant be edited so we delete and recreate for this

feat: Improve external trigger handling in Copilot

- Added validation for editing external triggers, ensuring users are informed that existing triggers must be deleted and recreated for changes.
- Updated documentation to clarify the limitations of external trigger modifications.

This update enhances user experience by providing clear guidance on managing external triggers within the Copilot interface.
This commit is contained in:
tusharmagar 2025-10-07 12:46:05 +08:00
parent 69eec4e41b
commit c01fbb09f4
2 changed files with 21 additions and 7 deletions

View file

@ -112,15 +112,27 @@ function enrich(response: string): z.infer<typeof CopilotResponsePart> {
}; };
} }
const actionPayload = {
action: metadata.action as 'create_new' | 'edit' | 'delete',
config_type: metadata.config_type as 'tool' | 'agent' | 'prompt' | 'pipeline' | 'start_agent' | 'one_time_trigger' | 'recurring_trigger' | 'external_trigger',
name: metadata.name,
change_description: jsonData.change_description || '',
config_changes: result.changes
};
if (actionPayload.config_type === 'external_trigger' && actionPayload.action === 'edit') {
return {
type: 'action',
action: {
...actionPayload,
error: "Editing external triggers isn't supported. Delete the trigger and create a new one with the updated settings—I can take care of that for you if you'd like."
}
};
}
return { return {
type: 'action', type: 'action',
action: { action: actionPayload
action: metadata.action as 'create_new' | 'edit' | 'delete',
config_type: metadata.config_type as 'tool' | 'agent' | 'prompt' | 'pipeline' | 'start_agent' | 'one_time_trigger' | 'recurring_trigger' | 'external_trigger',
name: metadata.name,
change_description: jsonData.change_description || '',
config_changes: result.changes
}
}; };
} }
} catch (e) { } catch (e) {

View file

@ -201,6 +201,8 @@ Note: The agents have access to a tool called 'Generate Image'. This won't show
Triggers are automated mechanisms that activate your agents at specific times or intervals. Evaluate every user request for automation or event driven tasks. If the user needs something to happen when an external event occurs (for example a new email, calendar invite, CRM update, or chat message), plan to add an external trigger after confirming the correct integration. Triggers are automated mechanisms that activate your agents at specific times or intervals. Evaluate every user request for automation or event driven tasks. If the user needs something to happen when an external event occurs (for example a new email, calendar invite, CRM update, or chat message), plan to add an external trigger after confirming the correct integration.
IMPORTANT: External triggers cannot be edited once created. If the user wants to change an external trigger, you must explain that the only option is to delete the existing trigger and create a new one with the updated configuration. Always offer to perform the delete-and-recreate workflow for them.
### Trigger Tool Search ### Trigger Tool Search
- Use the "search_relevant_triggers" tool whenever you need to discover external triggers. Provide a toolkit slug (for example "gmail") and optionally keywords from the user's request. - Use the "search_relevant_triggers" tool whenever you need to discover external triggers. Provide a toolkit slug (for example "gmail") and optionally keywords from the user's request.
- Do not invent trigger names. Always call the tool to confirm that the trigger exists before adding it to the workflow. - Do not invent trigger names. Always call the tool to confirm that the trigger exists before adding it to the workflow.