Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a3519f1
feat(chat): CU-17tkuw61kfy chat videos open from their card instead o…
michaelassraf Oct 28, 2026
b6cc660
feat(chat): CU-17tkuw61kfy card footers and source strips keep their …
michaelassraf Oct 29, 2026
facc207
fix(chat): CU-17tkuw61kfy the sources strip's skeleton is one row, on…
michaelassraf Oct 29, 2026
c56da62
feat(chat): CU-17tkuw61kfy a link to a screen of the app is an inline…
michaelassraf Oct 29, 2026
eb0d984
refactor(chat): CU-17tkuw61kfy one inline box component, InlineChip
michaelassraf Oct 29, 2026
556d341
refactor(chat): CU-17tkuw61kfy one card disclosure, an explicit app-s…
michaelassraf Oct 29, 2026
120f283
refactor(chat): CU-17tkuw61kfy in-app links by the runtime's rule, di…
michaelassraf Oct 29, 2026
ee333ac
Merge remote-tracking branch 'origin/main' into feat/mcp-in-app-links
michaelassraf Oct 29, 2026
bb8745a
fix(chat): CU-17tkuw61kfy the in-app link box is drawn inside the rou…
michaelassraf Oct 29, 2026
98be922
refactor(chat): CU-17tkuw61kfy markdown links read the navigation SSOT
michaelassraf Oct 29, 2026
81cf49d
refactor(chat): CU-17tkuw61kfy one navigation decision for every link…
michaelassraf Oct 29, 2026
8c78f9b
Merge branch 'main' into feat/mcp-in-app-links
michaelassraf Oct 29, 2026
5356117
refactor(chat): CU-17tkuw61kfy navigation goes through the host, with…
michaelassraf Oct 29, 2026
f636338
Merge remote-tracking branch 'origin/feat/mcp-in-app-links' into feat…
michaelassraf Oct 29, 2026
28f0873
feat(lint): CU-17tkuw61kfy flamingo/no-navigation-fallback blocks a s…
michaelassraf Oct 29, 2026
d85c25b
feat(chat): CU-17tkuw61kfy the navigation hooks a host's own links use
michaelassraf Oct 29, 2026
b17ce36
fix(chat): CU-17tkuw61kfy a link keeps the hub's old behavior exactly
michaelassraf Oct 29, 2026
eeea97f
Merge remote-tracking branch 'origin/main' into feat/mcp-in-app-links
michaelassraf Oct 29, 2026
5f148ed
fix(chat): CU-17tkuw61kfy one navigation path across the lib, from re…
michaelassraf Oct 29, 2026
5ffc671
fix(chat): CU-17tkuw61kfy review findings on the one navigation path
michaelassraf Oct 29, 2026
3b525ca
feat(chat): CU-17tkuw61kfy the host sets how many source skeletons an…
michaelassraf Oct 29, 2026
558e959
Merge branch 'main' into feat/mcp-in-app-links
michaelassraf Oct 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* is the lib rule with no target platform).
*/

import { fireEvent, render, screen } from '@testing-library/react';
import { fireEvent, render, screen, within } from '@testing-library/react';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { type ChatRuntime, ChatRuntimeContext } from '../../../contexts/chat-runtime-context';
import { ChatMessageEnhanced } from '../chat-message-enhanced';
Expand Down Expand Up @@ -101,13 +101,14 @@ describe('ChatMessageEnhanced — in-app screen links', () => {

it("draws a link that stays in the app as the inline box, by the runtime's own new-tab rule", () => {
renderAnswer(ANSWER);
// The box is the anchor around the lib's InlineChip (`InlineAppLinkChip`), routed by the same host anchor.
for (const anchor of screen.getAllByRole('link')) expect(anchor).toHaveClass('no-underline');
// The same routed anchor as every link (see the routing case above); only its content is the lib's InlineChip.
for (const anchor of screen.getAllByRole('link')) expect(within(anchor).getByTestId('inline-chip')).toBeTruthy();
});

it('keeps a link the runtime sends to a new tab a plain link, not a box', () => {
renderAnswer(ANSWER.replace(/\]\(\//g, `](${ORIGIN}/`));
expect(screen.getByRole('link', { name: 'Devices → Add Device' })).not.toHaveClass('no-underline');
const anchor = screen.getByRole('link', { name: 'Devices → Add Device' });
expect(within(anchor).queryByTestId('inline-chip')).toBeNull();
});

it('opens the same link written absolute in a new tab, even on the page origin', () => {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { InlineChip } from '../inline-chip';

describe('InlineChip', () => {
it('draws its label in the inline box', () => {
render(<InlineChip label="Devices → Add Device" />);
expect(screen.getByTestId('inline-chip')).toHaveTextContent('Devices → Add Device');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { cn } from '../../utils/cn';
import { isToday } from '../../utils/date-utils';
import { formatDate, formatTime } from '../../utils/format-date';
import { AgentMark } from '../agent-mark';
import { BrowserWindowIcon } from '../icons-v2-generated/coding/browser-window-icon';
import type { MdRenderProps } from '../ui/markdown/base-components';
import { SimpleMarkdownRenderer } from '../ui/markdown/simple-markdown-renderer';
import { SquareAvatar } from '../ui/square-avatar';
Expand All @@ -31,7 +32,7 @@ import { ContextCompactionDisplay } from './context-compaction-display';
import { BlockCard, type BlockCardProps } from './entity-cards/block-card';
import { ErrorMessageDisplay } from './error-message-display';
import { EscalationOfferMessage } from './escalation-offer-message';
import { InlineAppLinkChip } from './inline-app-link-chip';
import { InlineChip } from './inline-chip';
import { remarkCardLinks } from './remark-card-links';
import { remarkMentionChips } from './remark-mention-chips';
import { remarkStripCitations } from './remark-strip-citations';
Expand Down Expand Up @@ -469,27 +470,14 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
// flamingo hero-demo with mock content), fall back to a plain
// `<a href>`. No cross-origin sniffing here — the OSS-lib does
// not own routing decisions; the host does.
// A link that stays in this app is drawn as an inline box, the skin of the host's entity mentions, still
// routed through the host's `NavLinkAnchor`. Whether it stays is the runtime's ONE new-tab rule
// (`computeIsNewTab`, the decision the chat's cards and source chips make): a link it keeps in this window
// is a place in the app; one it sends to a new tab (another site, a hub page from an embedded chat, a
// `mailto:`) stays a plain link.
if (
typeof href === 'string' &&
!href.startsWith('#') &&
chatRuntime &&
!computeIsNewTab(chatRuntime, href, null)
) {
return (
<InlineAppLinkChip href={href} anchor={NavLinkAnchor}>
{children}
</InlineAppLinkChip>
);
}
if (typeof href === 'string' && NavLinkAnchor && !href.startsWith('#')) {
// Routing is untouched: the same anchor, href and props for every link. Only what it DRAWS changes for a
// link the runtime's own new-tab rule keeps in this window (a place in the app): the label as the inline
// box the host's entity mentions use.
const staysInApp = chatRuntime !== null && !computeIsNewTab(chatRuntime, href, null);
Comment thread
michaelassraf marked this conversation as resolved.
Resolved
return (
<NavLinkAnchor href={href} className={linkClassName} {...rest}>
{children}
{staysInApp ? <InlineChip icon={<BrowserWindowIcon />} label={children} /> : children}
</NavLinkAnchor>
);
}
Expand Down
2 changes: 1 addition & 1 deletion openframe-frontend-core/src/components/chat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@ export {
ASK_AI_TRIGGER_ATTRIBUTE,
} from './utils/ask-ai-events';
export * from './proxy-credentials-panel';
export { InlineAppLinkChip, InlineChip } from './inline-app-link-chip';
export { InlineChip } from './inline-chip';
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
*/

import type React from 'react';
import Link from '../../embed-shims/next-link';
import { cn } from '../../utils/cn';
import { BrowserWindowIcon } from '../icons-v2-generated/coding/browser-window-icon';
import { Tag } from '../ui/tag';

/**
Expand Down Expand Up @@ -49,31 +47,7 @@ export function InlineChip({
label={label}
loading={loading}
className={cn(INLINE_CHIP_CLASS, className)}
data-testid="inline-chip"
/>
);
}

/**
* A link that stays in this app (the runtime's `computeIsNewTab` keeps it in this window), drawn as an inline box. `anchor` is the host's link element (its
* `NavLinkAnchor`, so the click follows the host's routing rule), else the lib's boxed `Link`.
*/
export function InlineAppLinkChip({
href,
children,
anchor: Anchor,
}: {
href: string;
children: React.ReactNode;
anchor?: React.ComponentType<{ href: string; className?: string; children?: React.ReactNode }>;
}): React.ReactElement {
const chip = <InlineChip icon={<BrowserWindowIcon />} label={children} className="hover:bg-ods-bg-hover" />;
return Anchor ? (
<Anchor href={href} className="no-underline">
{chip}
</Anchor>
) : (
<Link href={href} className="no-underline">
{chip}
</Link>
);
}
Loading