FN-8288: add native structure preview foundation

Provide reusable, typed previews for native dashboard structures.

- Define five-kind native structure references and preview payloads.
- Add project-scoped preview resolution API with unavailable states and capped excerpts.
- Add a callback-driven inline preview card, tests, documentation, and release note.

Files changed:
 .changeset/fn-8288-native-structure-preview.md     |   7 ++
 docs/dashboard-guide.md                            |   4 +
 packages/core/src/index.gate.ts                    |   2 +-
 packages/core/src/index.ts                         |   1 +
 packages/core/src/types.ts                         |  54 ++++++++++
 packages/dashboard/app/api/legacy.ts               |   1 +
 packages/dashboard/app/api/task-content.ts         |  13 ++-
 .../app/components/NativeStructurePreview.css      |  61 +++++++++++
 .../app/components/NativeStructurePreview.tsx      | 115 +++++++++++++++++++++
 .../__tests__/NativeStructurePreview.test.tsx      | 102 ++++++++++++++++++
 packages/dashboard/src/native-structure-preview.ts |  88 ++++++++++++++++
 .../native-structure-preview-routes.test.ts        | 102 ++++++++++++++++++
 .../src/routes/register-task-workflow-routes.ts    |  23 +++++
 13 files changed, 571 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-8288

Fusion-Task-Lineage: 1a4ce369-9f9e-4a45-b533-2d53b5f1020c

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
This commit is contained in:
gsxdsm
2026-07-18 18:11:02 -07:00
parent ed2ffc4885
commit e2b5532290
13 changed files with 571 additions and 2 deletions

View File

@@ -254,6 +254,7 @@ export {
artifactMediaUrl,
artifactMediaUrlWithToken,
fetchArtifact,
fetchNativeStructurePreview,
updateArtifact,
fetchAllDocuments,
fetchProjectMarkdownFiles,

View File

@@ -12,6 +12,8 @@ import type {
Artifact,
ArtifactType,
ArtifactWithTask,
NativeStructureRef,
NativeStructurePreviewResult,
AgentLogEntry,
} from "@fusion/core";
import { appendTokenQuery, withTokenHeader } from "../auth";
@@ -206,6 +208,16 @@ export async function fetchArtifact(id: string, projectId?: string): Promise<Art
return api<Artifact>(withProjectId(`/artifacts/${encodeURIComponent(id)}`, projectId));
}
/**
* FNXC:NativeStructureEmbed 2026-07-18-18:15:
* Fetch the shared compact projection for an in-app native structure reference.
*/
export async function fetchNativeStructurePreview(ref: NativeStructureRef): Promise<NativeStructurePreviewResult> {
return api<NativeStructurePreviewResult>(
withProjectId(`/native-structures/${encodeURIComponent(ref.kind)}/${encodeURIComponent(ref.id)}/preview`, ref.projectId),
);
}
export interface UpdateArtifactInput {
title?: string;
description?: string;
@@ -274,4 +286,3 @@ export function deleteTaskDocument(taskId: string, key: string, projectId?: stri
method: "DELETE",
});
}