Files
fusion/packages/dashboard/app/components/nativeStructureNavigation.ts
gsxdsm bc4b679598 FN-8291: add inline native structure previews to chat
Enable chat users to inspect and open referenced native structures inline.

- Render clickable inline previews for native structure references across chat surfaces.
- Route preview actions to their corresponding task, mission, goal, and other dashboard views.
- Add regression coverage, dashboard documentation, and a CLI changeset.

Files changed:
 ...fn-8291-chat-native-structure-inline-preview.md |   7 +
 docs/dashboard-guide.md                            |   5 +-
 packages/dashboard/app/App.tsx                     |  31 +++
 .../app/components/StandardChatSurface.tsx         | 226 ++++++++++++++++--
 ...andardChatSurface.nativeStructureEmbed.test.tsx | 257 +++++++++++++++++++++
 .../__tests__/nativeStructureChatRef.test.ts       |  54 +++++
 .../app/components/nativeStructureChatRef.ts       |  58 +++++
 .../app/components/nativeStructureNavigation.ts    |  21 ++
 8 files changed, 635 insertions(+), 24 deletions(-)

Fusion-Task-Id: FN-8291

Fusion-Task-Lineage: 9db2c0fa-494e-4779-93f3-3309eed8565a

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-18 19:36:57 -07:00

22 lines
923 B
TypeScript

import type { NativeStructurePreviewResult, NativeStructureRef } from "@fusion/core";
export const NATIVE_STRUCTURE_OPEN_EVENT = "fusion:native-structure-open";
export interface NativeStructureOpenEventDetail {
ref: NativeStructureRef;
payload: NativeStructurePreviewResult;
}
/**
* FNXC:NativeStructureEmbed 2026-07-19-19:30:
* StandardChatSurface is shared by room, task-bound, floating, and dock chat, so its preview
* callback crosses this narrow event boundary instead of adding navigation forks to each host.
* App owns translating the foundation's callback/view-state target into the active dashboard view.
*/
export function openNativeStructure(ref: NativeStructureRef, payload: NativeStructurePreviewResult): void {
if (typeof window === "undefined") return;
window.dispatchEvent(new CustomEvent<NativeStructureOpenEventDetail>(NATIVE_STRUCTURE_OPEN_EVENT, {
detail: { ref, payload },
}));
}