Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
febd39a
feat: introduce Artifacts page with server integration
harshil-2096 Nov 24, 2026
b42b215
Merge remote-tracking branch 'origin' into feature/hv/artifacts-listi…
harshil-2096 Nov 24, 2026
4d6923f
feat: integrate BE listing artifacts api
harshil-2096 Nov 24, 2026
e830c49
feat: truncate artifact names in URLs to a maximum length of 32 chara…
harshil-2096 Nov 24, 2026
9a6971d
refactor: update ArtifactsButton icon and modify ArtifactsTable to di…
harshil-2096 Nov 24, 2026
b8289e1
refactor: update ArtifactsButton icon and modify ArtifactsTable to di…
harshil-2096 Nov 24, 2026
960831e
Merge branch 'main' into feature/hv/artifacts-listing-ui
harshil-2096 Nov 24, 2026
334977d
Merge remote-tracking branch 'origin/main' into feature/hv/artifacts-…
harshil-2096 Nov 27, 2026
95297ce
feat: wire artifact rename and align artifacts UI with BE response
harshil-2096 Nov 27, 2026
705a665
feat: hide artifacts scope filter until the list API supports it
harshil-2096 Nov 27, 2026
d8d01bb
feat: add session artifacts listing ui
harshil-2096 Nov 27, 2026
0a92839
feat: hide Share and Delete options in artifact menu until API suppo…
harshil-2096 Nov 27, 2026
acb9b7a
merge: update session artifacts branch with artifacts-listing-ui base
harshil-2096 Nov 27, 2026
a532302
implement session artifacts toggle and update artifact icons
harshil-2096 Nov 27, 2026
e185088
enhance session artifacts container with transition effects and impro…
harshil-2096 Nov 27, 2026
fd8307a
refactor: enhance session artifacts functionality with improved empty…
harshil-2096 Dec 1, 2026
0c1f962
chore:remove multiple changelog files
harshil-2096 Dec 1, 2026
631bf93
Merge remote-tracking branch 'origin' into feature/hv/artifacts-listi…
harshil-2096 Dec 1, 2026
51aaf71
refactor: standardize event handler definitions across components for…
harshil-2096 Dec 1, 2026
558713c
bugfix:remove FileTree component and update SessionArtifactsCard to r…
harshil-2096 Dec 1, 2026
a5f31ae
Merge branch 'main' into feature/hv/artifacts-listing-in-session
harshil-2096 Dec 2, 2026
9c0e08d
Show folder artifacts as file trees in the preview and session card
harshil-2096 Dec 2, 2026
f29df18
chore: Artifact structure to include filesMetadata
harshil-2096 Dec 2, 2026
2822533
fix: Enhance session artifacts handling by introducing selected artif…
harshil-2096 Dec 2, 2026
0a6a67c
Merge branch 'main' into feature/hv/artifacts-listing-in-session
harshil-2096 Dec 3, 2026
d9dcceb
Merge remote-tracking branch 'origin' into feature/hv/artifacts-listi…
harshil-2096 Dec 3, 2026
5b16947
fix: enhance artifact handling with entry file previews and improved …
harshil-2096 Dec 3, 2026
45b7b7f
Merge branch 'main' into feature/hv/artifacts-listing-in-session
harshil-2096 Dec 3, 2026
303099b
fix: update FilePreviewHost logic to reset selection on folder change…
harshil-2096 Dec 3, 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
7 changes: 7 additions & 0 deletions .changeset/artifact-entry-point-and-access-errors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@truefoundry/trueforge-assistant-ui-runtime': patch
'@truefoundry/trueforge-ui': patch
'@truefoundry/trueforge': patch
---

Open folder artifacts on their entry file, with the file list beside it, and expand a folder in the session card to preview its entry file. Show an access message when an artifact or its files are refused (403) and a not-found message on 404, instead of a generic failure. Show artifact size in the Artifacts table, drop its Created by column, and show file modified times in the folder tree. Renaming an artifact keeps its cached file listings. `Artifact.filesMetadata.sizeBytes` and `entryPoint` are no longer nullable, `ArtifactFile` gains `lastModified`, and `ArtifactServer` drops the unsupported `deleteArtifact` and `readArtifactFile` `version`.
7 changes: 7 additions & 0 deletions .changeset/artifact-is-dir-and-get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@truefoundry/trueforge-assistant-ui-runtime': patch
'@truefoundry/trueforge-ui': patch
'@truefoundry/trueforge': patch
---

`Artifact` carries `filesMetadata` (`isDir`, `sizeBytes`, `entryPoint`) from the get, list and session list responses, replacing `isDir` and `ArtifactDetail`. `ArtifactServer.getArtifact` resolves an `Artifact`, and `ArtifactServer` gains `listArtifactFiles`. The harness adapter wires get, list files and `readArtifactFile` (by path, defaulting to the entry file). A single-file artifact previews its entry file by extension. A folder artifact previews with its file list beside the open file (hidden when maximized), shows folder and file icons, and has no Download action. The session artifacts card shows a loading skeleton and lists a folder's files as an expandable tree; picking a file previews just that file. Folder listings are cached per artifact version.
7 changes: 7 additions & 0 deletions .changeset/session-artifacts-listing-ui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@truefoundry/trueforge-assistant-ui-runtime': patch
'@truefoundry/trueforge-ui': patch
'@truefoundry/trueforge': patch
---

Show a session Artifacts card in the chat with type labels, "Show N more", and expandable folder rows for files that share a directory. `ArtifactServer` gains `listSessionArtifacts`. Add an Artifacts button before Share in the chat header, shown once the session has artifacts, to hide or show the session artifacts card. Use the Lucide `image` icon for image artifacts in the session tree and file preview header.
1 change: 1 addition & 0 deletions packages/assistant-ui-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export type {
AgentUIServerPort,
ApprovalDecision,
Artifact,
ArtifactFile,
ArtifactServer,
AuthenticateConnectorRequest,
AutoModel,
Expand Down
1 change: 1 addition & 0 deletions packages/assistant-ui-runtime/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type {
AgentUIServerPort,
ApprovalDecision,
Artifact,
ArtifactFile,
ArtifactServer,
AuthenticateConnectorRequest,
AutoModel,
Expand Down
31 changes: 27 additions & 4 deletions packages/assistant-ui-runtime/src/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,26 @@ export interface Artifact {
createdBySubject: Subject;
createdAt: string;
updatedAt: string;
/** Describes the latest version; list and session list responses carry it too. */
filesMetadata: {
/** True when the latest version is a folder; a single top-level file is false. */
isDir: boolean;
/** Total size in bytes of the latest version's files. */
sizeBytes: number;
/** File to render first, relative to the artifact files. */
entryPoint: string;
};
}

/** One entry of a folder artifact's latest version; listings are one level deep. */
export interface ArtifactFile {
/** Path relative to the artifact files; folders end with `/`. */
path: string;
isDir: boolean;
/** Size in bytes; null for folders. */
size: number | null;
/** ISO-8601 modification time; null for folders. */
lastModified: string | null;
}

export interface ListArtifactsParams extends Pick<PageParams, 'limit' | 'pageToken'> {
Expand All @@ -1424,11 +1444,14 @@ export interface ListArtifactsParams extends Pick<PageParams, 'limit' | 'pageTok
export interface ArtifactServer<TArtifact extends Artifact = Artifact> {
/** Caller's artifacts, most recently updated first. */
listArtifacts(req?: ListArtifactsParams): Promise<ListResult<TArtifact>>;
getArtifact(req: { id: string }): Promise<TArtifact>;
/** Artifacts with a version created in the session, most recently updated first. Not paginated. */
listSessionArtifacts(req: { sessionId: string }): Promise<TArtifact[]>;
getArtifact(req: { id: string }): Promise<Artifact>;
/** One folder level of the latest version; `path` is a folder relative to the artifact files, default the top level. */
listArtifactFiles(req: { id: string; path?: string }): Promise<ArtifactFile[]>;
updateArtifact(req: { id: string; name: string }): Promise<TArtifact>;
deleteArtifact(req: { id: string }): Promise<void>;
/** Defaults to the latest version's entry file. */
readArtifactFile(req: { id: string; version?: number; path?: string }): Promise<Blob>;
/** Reads the latest version. Without `path`, reads the file of a single-file artifact; a folder needs a `path`. */
readArtifactFile(req: { id: string; path?: string }): Promise<Blob>;
}

// ---------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions packages/trueforge-ui/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Primitives MUST render their own popovers, lists, and empty states and expose slot props (e.g. `renderOption`, `menuFooter`, `noDataPlaceholder`); consumers MUST NOT re-render those parts beside the primitive.
- Before adding inline markup, check `src/atoms/primitives/` and the `src/atoms/lib/` class helpers; extend an existing primitive rather than forking it.
- UI lengths use `rem` (1rem = 16px); prefer Tailwind scale utilities.
- JSX event handlers and callback props MUST NOT be multi-statement inline arrow functions; define a named handler (e.g. `handleToggleExpanded`) and pass it. Single-call forwards like `onClick={() => onOpen(item)}` are fine.

## Analytics

Expand Down
5 changes: 5 additions & 0 deletions packages/trueforge-ui/src/analytics/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,14 @@ export const AnalyticsEvents = {
PREVIEW_OPENED: 'trueforge.artifact.preview_opened',
DOWNLOADED: 'trueforge.artifact.downloaded',
EDITED: 'trueforge.artifact.edited',
SESSION_CARD_FOLDER_TOGGLED: 'trueforge.artifact.session_card_folder_toggled',
SESSION_CARD_PREVIEW_OPENED: 'trueforge.artifact.session_card_preview_opened',
SESSION_CARD_SHOW_MORE: 'trueforge.artifact.session_card_show_more',
SESSION_CARD_TOGGLED: 'trueforge.artifact.session_card_toggled',
},
FilePreview: {
RELOADED: 'trueforge.file_preview.reloaded',
FOLDER_FILE_SELECTED: 'trueforge.file_preview.folder_file_selected',
},
Sdk: {
HTTP_TIMEOUT: 'trueforge.sdk.http_timeout',
Expand Down
8 changes: 1 addition & 7 deletions packages/trueforge-ui/src/atoms/AttachmentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { USER_MESSAGE_ATTACHMENT_PREVIEW_REM } from '../constants/attachments.js';
import { Icon } from '../icons/Icon.js';
import { formatFileSize } from '../utils/formatFileSize.js';
import { auiButtonClass } from './lib/buttonClasses.js';
import { cn } from './lib/cn.js';
import { Avatar, AvatarFallback, AvatarImage } from './primitives/Avatar.js';
Expand Down Expand Up @@ -43,13 +44,6 @@ export function getAttachmentFileIconName(name: string): string {
return extension == null ? 'file' : (FILE_ICON_BY_EXTENSION[extension] ?? 'file');
}

function formatFileSize(bytes: number): string {
if (bytes === 0) return '0 B';
const megabytes = bytes / (1024 * 1024);
if (megabytes < 1) return `${(bytes / 1024).toFixed(2)} KB`;
return `${megabytes.toFixed(2)} MB`;
}

export function AttachmentCard({
name,
sizeBytes,
Expand Down
136 changes: 136 additions & 0 deletions packages/trueforge-ui/src/atoms/FilePreviewFolderBrowser.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
'use client';

import type { FolderTree } from '../filePreview/useFolderTree.js';
import { Icon } from '../icons/Icon.js';
import type { ArtifactFile } from '../server/types.js';
import { formatFileSize } from '../utils/formatFileSize.js';
import { artifactType } from './artifacts/artifactDisplay.js';
import { cn } from './lib/cn.js';
import { formatAbsoluteDateTime } from './lib/dateFormat.js';
import { Skeleton } from './primitives/Skeleton.js';

export type FilePreviewFolderBrowserProps = {
tree: FolderTree;
selectedPath: string | null;
onSelect: (path: string) => void;
};

const INDENT_REM = 0.75;

function entryName(path: string): string {
return path.replace(/\/$/, '').split('/').pop() ?? path;
}

function LevelMessage({ children }: { children: string }) {
return <p className="px-2 py-1.5 text-xs text-text-secondary">{children}</p>;
}

function FolderLevel({
path,
depth,
tree,
selectedPath,
onSelect,
}: FilePreviewFolderBrowserProps & { path: string; depth: number }) {
const level = tree.levels[path];
if (level === undefined || level.status === 'loading') {
return (
<div
role="status"
aria-label="Loading files"
style={{ paddingLeft: `${String(depth * INDENT_REM + 0.5)}rem` }}
className="flex flex-col gap-2 py-2 pr-2"
>
{['w-3/4', 'w-1/2', 'w-2/3'].map(width => (
<div key={width} className="flex items-center gap-2">
<Skeleton className="h-3.5 w-3.5 shrink-0" />
<Skeleton className={cn('h-3', width)} />
</div>
))}
</div>
);
}
if (level.status === 'error') return <LevelMessage>{level.message}</LevelMessage>;
if (level.entries.length === 0) return <LevelMessage>This folder is empty.</LevelMessage>;

const renderEntry = (entry: ArtifactFile) => {
const name = entryName(entry.path);
const indent = { paddingLeft: `${String(depth * INDENT_REM + 0.5)}rem` };
if (entry.isDir) {
const open = tree.expanded.has(entry.path);
return (
<li key={entry.path}>
<button
type="button"
aria-expanded={open}
onClick={() => tree.toggle(entry.path)}
style={indent}
className="flex w-full cursor-pointer items-center gap-1.5 rounded-md py-1.5 pr-2 text-left text-sm text-text-primary hover:bg-secondary-button-hover"
>
<Icon name={open ? 'chevron-down' : 'chevron-right'} size={14} className="text-text-secondary" />
<Icon name="folder" size={14} className="text-text-secondary" />
<span className="min-w-0 flex-1 truncate">{name}</span>
</button>
{/* Kept mounted once opened so collapsing does not drop what was already loaded. */}
{open || tree.levels[entry.path] !== undefined ? (
<div hidden={!open}>
<FolderLevel
path={entry.path}
depth={depth + 1}
tree={tree}
selectedPath={selectedPath}
onSelect={onSelect}
/>
</div>
) : null}
</li>
);
}
const selected = entry.path === selectedPath;
return (
<li key={entry.path}>
<button
type="button"
onClick={() => onSelect(entry.path)}
style={indent}
{...(entry.lastModified === null
? {}
: { title: `Modified ${formatAbsoluteDateTime(new Date(entry.lastModified))}` })}
{...(selected ? { 'aria-current': true } : {})}
className={cn(
'flex w-full cursor-pointer items-center gap-1.5 rounded-md py-1.5 pr-2 text-left text-sm text-text-primary hover:bg-secondary-button-hover',
selected && 'bg-secondary-button-hover',
)}
>
<span aria-hidden className="size-3.5 shrink-0" />
<Icon
name={artifactType({ name, isDir: false }).icon}
size={14}
className="shrink-0 text-primary-button-bg"
/>
<span className="min-w-0 flex-1 truncate">{name}</span>
{entry.size === null ? null : (
<span className="shrink-0 text-xs text-text-secondary">{formatFileSize(entry.size)}</span>
)}
</button>
</li>
);
};

return <ul className="flex flex-col">{level.entries.map(renderEntry)}</ul>;
}

/** Lazy file tree of a folder artifact; files are selected, folders only open or close. */
export function FilePreviewFolderBrowser(props: FilePreviewFolderBrowserProps) {
return (
<nav aria-label="Folder files">
<FolderLevel {...props} path="" depth={0} />
</nav>
);
}

declare module '../theme/SlotsProvider.js' {
interface AtomSlots {
FilePreviewFolderBrowser: typeof FilePreviewFolderBrowser;
}
}
Loading