fix(chat): resolve agent prose links against the host app base#23
Merged
Conversation
Clicked links in chat prose were forwarded as the iframe-resolved href, so the iframe's own /agents/.../chat URL became the resolution base and app-relative links (e.g. /dataset/x/table, or a bare dataset/x/table) got mangled — the host then full-reloaded to a 404 (missing the deployment base prefix). - AgentChatMessages: forward the raw href the model wrote, not the DOM-resolved one, so intent survives the iframe round-trip. - useAgentChatBase: resolve the link against our own router base via the new resolveAgentLink helper — strip the base when present, and when an app-relative path omits it, router.push it if it maps to a real route (in-SPA nav) instead of full-reloading; external origins and unmatched same-origin paths still do a full navigation. Pure helper in lib-vuetify/link-utils.ts, unit-tested. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Agent-authored chat links written as app-relative paths (
/dataset/x/table, oreven bare
dataset/x/table) were resolved against the chat iframe's own URL(
/agents/.../chat), producing broken full-page reloads.What changed:
resolveAgentLinkhelper (lib-vuetify/link-utils.ts) — resolves araw href against the embedding app's origin + router base, deciding external vs.
in-app and stripping the base prefix. Unit-tested, no vue-router/window deps.
AgentChatMessages.vuenow forwards the rawhrefattribute (not theDOM-resolved
.href), so app-relative links aren't corrupted by the iframe URL.useAgentChatBase.tsnavigates in-SPA only when the resolved path matches a realroute, otherwise falls back to a full navigation.
@data-fair/lib-vuetify-agents0.6.1.Why: models frequently write links that omit the deployment base prefix; these
were dead clicks. The host knows its router base, so resolution belongs there.
Regression risks:
navigate in-SPA; all other cases (external, unmatched same-origin) fall back to a
full navigation. Confirm no external embedder of the
navigateevent relied onreceiving a pre-resolved URL.
mailto:/tel:/anchor hrefs route through the same path (treated as external ->full navigation); not covered by a test.