FN-6779: add artifacts gallery to Documents

Adds a Documents-view artifact gallery backed by dashboard artifact registry APIs.

- Add artifact listing and media-serving endpoints with project scoping, validation, and safe artifact path resolution.
- Add client artifact API helpers, SWR caching, and a useArtifacts hook for background-refresh gallery data.
- Extend Documents view with an Artifacts tab, media previews, localized labels, documentation, tests, and a published package changeset.

Files changed:
 .changeset/fn-6779-artifacts-gallery.md            |   5 +
 docs/dashboard-guide.md                            |   6 +-
 packages/dashboard/app/api/legacy.ts               |  34 ++++
 .../dashboard/app/components/DocumentsView.css     | 142 ++++++++++++++++
 .../dashboard/app/components/DocumentsView.tsx     | 178 ++++++++++++++++++--
 .../components/__tests__/DocumentsView.test.tsx    | 163 +++++++++++++++++-
 .../app/hooks/__tests__/useArtifacts.test.ts       | 136 +++++++++++++++
 packages/dashboard/app/hooks/useArtifacts.ts       | 145 ++++++++++++++++
 packages/dashboard/app/utils/swrCache.ts           |   1 +
 .../src/routes/__tests__/artifacts-routes.test.ts  | 182 +++++++++++++++++++++
 .../src/routes/register-task-workflow-routes.ts    | 125 ++++++++++++++
 packages/i18n/locales/en/app.json                  |  22 ++-
 packages/i18n/locales/es/app.json                  |  27 ++-
 packages/i18n/locales/fr/app.json                  |  27 ++-
 packages/i18n/locales/ko/app.json                  |  27 ++-
 packages/i18n/locales/zh-CN/app.json               |  27 ++-
 packages/i18n/locales/zh-TW/app.json               |  27 ++-
 scripts/line-count-baseline.json                   |  16 +-
 18 files changed, 1255 insertions(+), 35 deletions(-)

Fusion-Task-Id: FN-6779

Fusion-Task-Lineage: 1d71e4be-4bfc-4706-9cbf-7214f91a79d1
This commit is contained in:
gsxdsm
2026-06-21 16:01:07 -07:00
parent 7ee1fec22c
commit ef4889585f
18 changed files with 1255 additions and 35 deletions

View File

@@ -27,6 +27,9 @@ import type {
TaskDocument,
TaskDocumentRevision,
TaskDocumentWithTask,
Artifact,
ArtifactType,
ArtifactWithTask,
Message,
MessageMetadata,
@@ -1474,6 +1477,37 @@ export interface MarkdownFileListResponse {
files: MarkdownFileEntry[];
}
export type { Artifact, ArtifactType, ArtifactWithTask };
export interface FetchArtifactsOptions {
type?: ArtifactType;
authorId?: string;
taskId?: string;
q?: string;
limit?: number;
offset?: number;
}
export async function fetchArtifacts(
options?: FetchArtifactsOptions,
projectId?: string,
): Promise<ArtifactWithTask[]> {
const params = new URLSearchParams();
if (options?.type) params.set("type", options.type);
if (options?.authorId) params.set("authorId", options.authorId);
if (options?.taskId) params.set("taskId", options.taskId);
if (options?.q) params.set("q", options.q);
if (options?.limit !== undefined) params.set("limit", String(options.limit));
if (options?.offset !== undefined) params.set("offset", String(options.offset));
const queryString = params.toString();
const path = `/artifacts${queryString ? `?${queryString}` : ""}`;
return api<ArtifactWithTask[]>(withProjectId(path, projectId));
}
export function artifactMediaUrl(id: string, projectId?: string): string {
return buildApiUrl(withProjectId(`/artifacts/${encodeURIComponent(id)}/media`, projectId));
}
export async function fetchAllDocuments(
options?: FetchAllDocumentsOptions,
projectId?: string,