fix(agent-editor): create knowledge sources and prompt templates inline instead of navigating away - #603
Draft
esafwan wants to merge 1 commit into
Draft
fix(agent-editor): create knowledge sources and prompt templates inline instead of navigating away#603esafwan wants to merge 1 commit into
esafwan wants to merge 1 commit into
Conversation
…ne instead of navigating away Creating a new knowledge source or prompt template from inside the Agent editor used to call navigate() to a standalone route (/knowledge/new, /prompts/new), abandoning the in-progress agent form and breaking the user's flow. Triggers already avoid this by creating in an in-context Dialog; extend that pattern here. - Extract KnowledgeSourceForm as a shared component consumed by both the standalone /knowledge/new|:id route and a new KnowledgeSourceCreateModal opened from AgentKnowledgeModal, so the standalone route's behavior is unchanged while the agent-editor entry point now stays in-context. - Add a create-only PromptTemplateCreateModal for the agent editor's PromptTemplateSection "New" button, replacing the navigate() + returnTo/ localStorage round-trip with a direct in-modal create + select. The standalone /prompts/new route (with its own returnTo consumers, e.g. AdvancedTab's summary prompt flow) is untouched. Same navigate-away pattern still exists for MCP servers, summary prompts, execution profiles, and SSH connections inside the agent editor - tracked as follow-up, not fixed in this change.
Contributor
Author
|
Backend CI failure ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Inside the Agent editor (
/agents/:id), the agent-in-progress lives only in localreact-hook-formstate. Clicking "create a new knowledge source" or "New" prompt template used to callnavigate()to a standalone route (/knowledge/new,/prompts/new), abandoning the in-progress agent form and taking the user out of flow entirely. Triggers already avoid this bug —TriggersTab/TriggerModalcreate in-context via aDialog, no navigation. This PR extends that pattern to Knowledge and Prompt Templates.KnowledgeSourceFormas a shared, presentational component now consumed by both the standalone/knowledge/new/:idroute (behavior unchanged) and a newKnowledgeSourceCreateModal, opened in-context fromAgentKnowledgeModal. New sources attach directly to the agent's local Knowledge state, same as linking an existing source.PromptTemplateCreateModalfor the agent editor's "New" button, replacing thenavigate()+returnTo/localStorage round-trip with a direct in-modal create + auto-select. The standalone/prompts/newroute and its otherreturnToconsumers (e.g.AdvancedTab's summary-prompt flow) are untouched.Both preserve the existing "agent must be saved first" precondition, and both new modals include a dirty-close confirm guard so accidental Escape/backdrop-click doesn't silently discard input.
Scope / follow-ups
The same navigate-away-from-unsaved-agent-form pattern exists at four more entry points in the agent editor, not touched here: MCP servers, summary prompts, execution profiles, and SSH connections (all in
AgentFormPage.tsx/AdvancedTab.tsx). Deferred as follow-up work using the same in-context-modal pattern established in this PR, not silently left broken."Automations" (from the original bug report) maps to Agent Triggers, which already uses the correct in-context pattern — no change needed there. The separate
/flowsFlow-builder feature (which has its own "Automation" flow type) is not currently invoked from the agent editor, so it's out of scope.Testing
yarn typecheckpasses with no errors.yarn lintfails with a pre-existing environment error (minimatch/ESLint 9 config-array crash) that reproduces identically ondevelop— not introduced by this change./knowledge/newand/prompts/newroutes were diffed to confirm the extraction is byte-for-byte equivalent, not a behavior change.Test plan
/knowledge/newand/prompts/new(direct navigation, not from agent editor) still work identically.