The open-source agent harness - the runtime layer that turns an LLM into a working agent.
chore: add sandbox snapshot status badge and remove snapshot name (#262)
sayan-truefoundry224b30d332c1
diff --git a/docs/ui-sdk/reference/catalog.mdx b/docs/ui-sdk/reference/catalog.mdxindex 5411f0ba1..9ff13ffe8 100644--- a/docs/ui-sdk/reference/catalog.mdx+++ b/docs/ui-sdk/reference/catalog.mdx@@ -181,9 +181,19 @@ never returned.<Accordion title="Sandbox providers">```ts+ interface SandboxSnapshotSyncStatus {+ status: 'pending' | 'ready' | 'failed';+ statusReason?: string;+ }++ interface SandboxProviderListEntry {+ data: SandboxProviderBase;+ snapshotSyncStatus: SandboxSnapshotSyncStatus;+ }+interface SandboxCatalogServer {getSandboxProviderCatalog(): Promise<SandboxProviderCatalogEntry[]>;- listSandboxProviders(req?: { query?: string }): Promise<SandboxProviderBase[]>;+ listSandboxProviders(req?: { query?: string }): Promise<SandboxProviderListEntry[]>;createSandboxProvider(req: CreateSandboxProviderRequest): Promise<SandboxProviderBase>;updateSandboxProvider(req: UpdateSandboxProviderRequest): Promise<SandboxProviderBase>;deleteSandboxProvider?(req: { id: string }): Promise<void>;@@ -194,7 +204,6 @@ never returned.```tsinterface SandboxProviderConfig {- snapshotName: string;execTimeoutMs: number;autoStopIntervalInMinutes: number;autoArchiveIntervalInMinutes: number;@@ -209,6 +218,8 @@ never returned.`SandboxProviderBase` extends that config with `{ id, name, catalogId, isConnected }`. Noteit carries the last-saved config rather than omitting it, so an update form can show currentvalues without a second fetch. `SandboxProviderCatalogEntry` adds `{ id, name, type }`.+ `SandboxProviderListEntry` pairs each configured provider with the current snapshot sync+ status. A failed status may include `statusReason` with a human-readable failure detail.`CreateSandboxProviderRequest` adds `catalogId`, `name`, `type`, and a required `apiKey`.`UpdateSandboxProviderRequest` takes `id` plus the config, with an **optional** `apiKey` —diff --git a/packages/frontend/package.json b/packages/frontend/package.jsonindex 8a6a5e8fe..dcd20124a 100644--- a/packages/frontend/package.json+++ b/packages/frontend/package.json@@ -24,7 +24,7 @@"@assistant-ui/core": "0.2.22","@assistant-ui/react": "^0.14.24","@assistant-ui/store": "0.2.21",- "@truefoundry/assistant-ui-runtime": "0.1.16",+ "@truefoundry/assistant-ui-runtime": "0.1.17","@truefoundry/trueforge-sdk": "workspace:*","@truefoundry/trueforge-ui": "workspace:*","monaco-editor": "^0.52.0",diff --git a/packages/trueforge-ui-sdk/example/package.json b/packages/trueforge-ui-sdk/example/package.jsonindex 1d4cb2b09..c2467a7ab 100644--- a/packages/trueforge-ui-sdk/example/package.json+++ b/packages/trueforge-ui-sdk/example/package.json@@ -12,7 +12,7 @@"dependencies": {"@assistant-ui/core": "^0.2.22","@assistant-ui/react": "^0.14.24",- "@truefoundry/assistant-ui-runtime": "0.1.16",+ "@truefoundry/assistant-ui-runtime": "0.1.17","@truefoundry/trueforge-ui": "link:..","react": "^19.2.4","react-dom": "^19.2.4",diff --git a/packages/trueforge-ui-sdk/example/src/App.tsx b/packages/trueforge-ui-sdk/example/src/App.tsxindex a18a8b3c6..d961a844c 100644--- a/packages/trueforge-ui-sdk/example/src/App.tsx+++ b/packages/trueforge-ui-sdk/example/src/App.tsx@@ -223,7 +223,6 @@ const emptyCatalog: CatalogServer = {name: req.name,catalogId: req.catalogId,isConnected: true,- snapshotName: req.snapshotName,execTimeoutMs: req.execTimeoutMs,autoStopIntervalInMinutes: req.autoStopIntervalInMinutes,autoArchiveIntervalInMinutes: req.autoArchiveIntervalInMinutes,@@ -234,7 +233,6 @@ const emptyCatalog: CatalogServer = {name: req.id,catalogId: req.id,isConnected: true,- snapshotName: req.snapshotName,execTimeoutMs: req.execTimeoutMs,autoStopIntervalInMinutes: req.autoStopIntervalInMinutes,autoArchiveIntervalInMinutes: req.autoArchiveIntervalInMinutes,diff --git a/packages/trueforge-ui-sdk/package.json b/packages/trueforge-ui-sdk/package.jsonindex 84c3012aa..5f4a3928a 100644--- a/packages/trueforge-ui-sdk/package.json+++ b/packages/trueforge-ui-sdk/package.json@@ -94,7 +94,7 @@"@openuidev/react-headless": "^0.9.4","@openuidev/react-lang": "^0.2.9","@openuidev/react-ui": "^0.13.2",- "@truefoundry/assistant-ui-runtime": "0.1.16",+ "@truefoundry/assistant-ui-runtime": "0.1.17","clsx": "^2.1.1","lucide-react": "^0.562.0","monaco-editor": "^0.56.0",diff --git a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConfigureSandboxForm.tsx b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConfigureSandboxForm.tsxindex 1e2a8ef2c..c12c1957a 100644--- a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConfigureSandboxForm.tsx+++ b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConfigureSandboxForm.tsx@@ -31,7 +31,6 @@ type ConfigureSandboxFormProps = {/** Sensible defaults so the advanced fields are never blank, even without a catalog preset. */const EMPTY_CONFIG: SandboxProviderConfig = {// Snapshot/image is release-owned now; kept only to satisfy the external SandboxProviderConfig type.- snapshotName: '',execTimeoutMs: 300000,autoStopIntervalInMinutes: 15,autoArchiveIntervalInMinutes: 10080,@@ -112,7 +111,6 @@ const ConfigureSandboxForm = ({try {await onSave({// Snapshot/image is release-owned; the field is retained only for the external type.- snapshotName: '',execTimeoutMs: execTimeout,autoStopIntervalInMinutes: autoStop,autoArchiveIntervalInMinutes: autoArchive,diff --git a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/SandboxSettings.tsx b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/SandboxSettings.tsxindex f62f86704..e2a2005e5 100644--- a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/SandboxSettings.tsx+++ b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/SandboxSettings.tsx@@ -2,33 +2,66 @@import { useCallback, useEffect, useMemo, useState } from 'react';+import { Spinner } from '@/atoms/primitives/Spinner.js';import { Button } from '../../atoms/primitives/Button.js';+import { Tooltip } from '../../atoms/primitives/Tooltip.js';import { Icon } from '../../icons/Icon.js';import { useCatalogServer } from '../../server/ServerContext.js';-import type { SandboxProviderBase, SandboxProviderCatalogEntry, SandboxProviderConfig } from '../../server/types.js';+import type {+ SandboxProviderBase,+ SandboxProviderCatalogEntry,+ SandboxProviderConfig,+ SandboxProviderListEntry,+ SandboxSnapshotSyncStatus,+} from '../../server/types.js';import { getErrorMessage } from '../../utils/getErrorMessage.js';import { useToasterOptional } from '../ToasterContainer.js';import ConfigureSandboxForm, { type SandboxConfigDraft } from './ConfigureSandboxForm.js';+const SNAPSHOT_STATUS_POLL_INTERVAL_MS = 10000;+const configFrom = ({- snapshotName,execTimeoutMs,autoStopIntervalInMinutes,autoArchiveIntervalInMinutes,autoDeleteIntervalInMinutes,}: SandboxProviderConfig): SandboxProviderConfig => ({- snapshotName,execTimeoutMs,autoStopIntervalInMinutes,autoArchiveIntervalInMinutes,autoDeleteIntervalInMinutes,});+const statusPresentation = (status: SandboxSnapshotSyncStatus['status']): { label: string; className: string } => {+ switch (status) {+ case 'pending':+ return {+ label: 'Syncing image...',+ className: 'text-warning-bg',+ };+ case 'ready':+ return {+ label: 'Connected',+ className: 'text-success-bg',+ };+ case 'failed':+ return {+ label: 'Sync failed',+ className: 'text-failure-bg',+ };+ default:+ return {+ label: status,+ className: 'text-text-secondary',+ };+ }+};+const SandboxSettings = () => {const { sandboxCatalog } = useCatalogServer();const toaster = useToasterOptional();- const [providers, setProviders] = useState<SandboxProviderBase[]>([]);+ const [providers, setProviders] = useState<SandboxProviderListEntry[]>([]);const [catalog, setCatalog] = useState<SandboxProviderCatalogEntry[]>([]);const [loading, setLoading] = useState(true);const [error, setError] = useState<string | null>(null);@@ -63,11 +96,51 @@ const SandboxSettings = () => {void refresh();}, [refresh]);+ const hasPendingProvider = providers.some(entry => entry.snapshotSyncStatus.status === 'pending');++ useEffect(() => {+ if (!sandboxCatalog || !hasPendingProvider) return;+ const activeSandboxCatalog = sandboxCatalog;++ let cancelled = false;+ let timeoutId: number | undefined;++ function schedulePoll() {+ timeoutId = window.setTimeout(() => {+ void poll();+ }, SNAPSHOT_STATUS_POLL_INTERVAL_MS);+ }++ async function poll() {+ try {+ const listed = await activeSandboxCatalog.listSandboxProviders();+ if (cancelled) return;+ setProviders(listed);+ setError(null);+ if (listed.some(entry => entry.snapshotSyncStatus.status === 'pending')) {+ schedulePoll();+ }+ } catch (err) {+ if (cancelled) return;+ setError(getErrorMessage(err, 'Failed to refresh sandbox providers'));+ schedulePoll();+ }+ }++ schedulePoll();+ return () => {+ cancelled = true;+ if (timeoutId !== undefined) {+ window.clearTimeout(timeoutId);+ }+ };+ }, [sandboxCatalog, hasPendingProvider]);+// Tenant/UI-wide: only one sandbox provider may be configured at a time.const hasConfiguredProvider = providers.length > 0;const availableEntries = useMemo(() => {if (hasConfiguredProvider) return [];- const connectedCatalogIds = new Set(providers.map(provider => provider.catalogId));+ const connectedCatalogIds = new Set(providers.map(provider => provider.data.catalogId));return catalog.filter(entry => !connectedCatalogIds.has(entry.id));}, [catalog, providers, hasConfiguredProvider]);@@ -128,6 +201,15 @@ const SandboxSettings = () => {}, 0);};+ const handleRetry = (provider: SandboxProviderBase) => {+ void runMutation(async () => {+ await sandboxCatalog.updateSandboxProvider({+ id: provider.id,+ ...configFrom(provider),+ });+ }).catch(() => {});+ };+const handleRemove = (provider: SandboxProviderBase) => {const deleteSandboxProvider = sandboxCatalog.deleteSandboxProvider;if (!deleteSandboxProvider) return;@@ -168,60 +250,97 @@ const SandboxSettings = () => {Configured · {providers.length}</h4><div className="overflow-hidden rounded-xl border border-border bg-card-bg">- {providers.map(provider => (- <article- key={provider.id}- className="flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center"- >- <div className="flex min-w-0 flex-1 items-center gap-3">- <span- className="flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary"- aria-hidden- >- <Icon name="cube" className="size-4.5" />- </span>- <div className="min-w-0">- <h5 className="truncate text-sm font-medium text-text-primary">{provider.name}</h5>+ {providers.map(entry => {+ const provider = entry.data;+ const status = statusPresentation(entry.snapshotSyncStatus.status);+ const statusReason = entry.snapshotSyncStatus.statusReason;+ const statusIndicator = (+ <span className={`inline-flex items-center gap-1.5 text-sm font-medium ${status.className}`}>+ {entry.snapshotSyncStatus.status === 'pending' ? (+ <Spinner size={16} aria-label="Syncing snapshot image" />+ ) : entry.snapshotSyncStatus.status === 'ready' ? (+ <span className="size-2 rounded-full bg-success-bg" aria-hidden />+ ) : entry.snapshotSyncStatus.status === 'failed' ? (+ <Icon name="triangle-exclamation" className="size-4" />+ ) : null}+ {status.label}+ </span>+ );+ return (+ <article+ key={provider.id}+ className="flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center"+ >+ <div className="flex min-w-0 flex-1 items-center gap-3">+ <span+ className="flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary"+ aria-hidden+ >+ <Icon name="cube" className="size-4.5" />+ </span>+ <div className="min-w-0">+ <h5 className="truncate text-sm font-medium text-text-primary">{provider.name}</h5>+ </div></div>- </div>- <div className="flex flex-wrap items-center gap-2.5 sm:justify-end">- {provider.isConnected ? (- <span className="flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-success-bg">- <span className="h-1.5 w-1.5 rounded-full bg-success-bg"></span>- Connected- </span>- ) : null}- <Button- variant="secondary"- size="sm"- type="button"- disabled={busy}- onClick={() => {- setFormError(null);- setCreateEntry(null);- setUpdateProvider(provider);- }}- >- Update- </Button>- {sandboxCatalog.deleteSandboxProvider ? (+ <div className="flex flex-wrap items-center gap-2.5 sm:justify-end">+ {statusIndicator}+ {statusReason ? (+ <Tooltip content={statusReason}>+ <button+ type="button"+ aria-label="Snapshot sync status details"+ className="inline-flex text-text-secondary transition-colors hover:text-text-primary"+ >+ <Icon name="info" className="size-4" />+ </button>+ </Tooltip>+ ) : null}+ {entry.snapshotSyncStatus.status === 'failed' ? (+ <Button+ variant="ghost"+ size="sm"+ type="button"+ disabled={busy}+ onClick={() => {+ handleRetry(provider);+ }}+ >+ Retry+ </Button>+ ) : null}<Button- variant="ghost"+ variant="secondary"size="sm"- className="text-text-secondary"type="button"disabled={busy}onClick={() => {- handleRemove(provider);+ setFormError(null);+ setCreateEntry(null);+ setUpdateProvider(provider);}}>- Remove+ Update</Button>- ) : null}- </div>- </article>- ))}++ {sandboxCatalog.deleteSandboxProvider ? (+ <Button+ variant="ghost"+ size="sm"+ className="text-text-secondary"+ type="button"+ disabled={busy}+ onClick={() => {+ handleRemove(provider);+ }}+ >+ Remove+ </Button>+ ) : null}+ </div>+ </article>+ );+ })}</div></section>) : null}diff --git a/packages/trueforge-ui-sdk/src/icons/IconRegistry.tsx b/packages/trueforge-ui-sdk/src/icons/IconRegistry.tsxindex e8fec818f..b67f462c6 100644--- a/packages/trueforge-ui-sdk/src/icons/IconRegistry.tsx+++ b/packages/trueforge-ui-sdk/src/icons/IconRegistry.tsx@@ -51,6 +51,7 @@ import {Sun,Terminal,Trash2,+ TriangleAlert,Wrench,X,} from 'lucide-react';@@ -120,6 +121,8 @@ const defaults: Record<string, IconEntry> = {'box-archive': Archive,'clock-rotate-left': History,'circle-exclamation': CircleAlert,+ info: Info,+ 'triangle-exclamation': TriangleAlert,'chevron-down': ChevronDown,'chevron-left': ChevronLeft,'chevron-right': ChevronRight,@@ -163,7 +166,6 @@ const defaults: Record<string, IconEntry> = {compress: Minimize2,'external-link': ExternalLink,github: Github,- info: Info,};for (const [name, icon] of Object.entries(defaults)) {diff --git a/packages/trueforge-ui-sdk/src/index.ts b/packages/trueforge-ui-sdk/src/index.tsindex 1754114e0..a8db05dac 100644--- a/packages/trueforge-ui-sdk/src/index.ts+++ b/packages/trueforge-ui-sdk/src/index.ts@@ -301,6 +301,8 @@ export type {SandboxProviderBase,SandboxProviderCatalogEntry,SandboxProviderConfig,+ SandboxProviderListEntry,+ SandboxSnapshotSyncStatus,SaveAgentRequest,SaveAgentResult,SearchAgentsParams,diff --git a/packages/trueforge-ui-sdk/src/plugins/trueforge-agent-server-adapter/catalogs/sandboxProviderCatalog.ts b/packages/trueforge-ui-sdk/src/plugins/trueforge-agent-server-adapter/catalogs/sandboxProviderCatalog.tsindex 2c8d0ab93..9ee56aeab 100644--- a/packages/trueforge-ui-sdk/src/plugins/trueforge-agent-server-adapter/catalogs/sandboxProviderCatalog.ts+++ b/packages/trueforge-ui-sdk/src/plugins/trueforge-agent-server-adapter/catalogs/sandboxProviderCatalog.ts@@ -13,10 +13,12 @@ import type {SandboxProviderBase,SandboxProviderCatalogEntry,SandboxProviderConfig,+ SandboxProviderListEntry,} from '../../../server/types.js';export type UiSandboxProvider = SandboxProviderBase;export type UiSandboxProviderCatalogEntry = SandboxProviderCatalogEntry;+export type UiSandboxProviderListEntry = SandboxProviderListEntry;const DAYTONA_TYPE = 'daytona';const DAYTONA_DISPLAY_NAME = 'Daytona';@@ -34,7 +36,6 @@ export function configFromHarness(return {// Snapshot/image is now release-owned; the field is gone from the backend. The external// SandboxProviderConfig still requires it, so send an empty placeholder until that type drops it.- snapshotName: '',execTimeoutMs: provider.execTimeoutMs,autoStopIntervalInMinutes: provider.autoStopIntervalInMinutes,autoArchiveIntervalInMinutes: provider.autoArchiveIntervalInMinutes,@@ -61,6 +62,36 @@ export function toUiSandboxProvider(provider: TrueForgeApi.SandboxProviderManife};}+export function toUiSandboxProviderListEntry(+ response: TrueForgeApi.GetSandboxProviderResponse['data'],+): UiSandboxProviderListEntry {+ return {+ data: toUiSandboxProvider(response.manifest),+ snapshotSyncStatus: {+ status: response.status,+ ...(response.statusReason ? { statusReason: response.statusReason } : {}),+ },+ };+}++export function filterUiSandboxProviders({+ providers,+ query,+}: {+ providers: UiSandboxProviderListEntry[];+ query?: string;+}): UiSandboxProviderListEntry[] {+ const normalizedQuery = query?.trim().toLowerCase();+ if (normalizedQuery === undefined || normalizedQuery === '') {+ return providers;+ }+ return providers.filter(+ provider =>+ provider.data.name.toLowerCase().includes(normalizedQuery) ||+ provider.data.id.toLowerCase().includes(normalizedQuery),+ );+}+export function toHarnessManifest(req: {type: string;@@ -97,10 +128,10 @@ export function createSandboxProviderCatalog(client: TrueForge): SandboxCatalogSreturn body.data.map(toUiCatalogEntry);},listSandboxProviders: async req => {- let providers: UiSandboxProvider[];+ let providers: UiSandboxProviderListEntry[];try {const body = await client.settings.sandboxProviders.get();- providers = [toUiSandboxProvider(body.data.manifest)];+ providers = [toUiSandboxProviderListEntry(body.data)];} catch (err) {if (err instanceof TrueForgeApi.NotFoundError) {providers = [];@@ -108,13 +139,7 @@ export function createSandboxProviderCatalog(client: TrueForge): SandboxCatalogSthrow err;}}- const query = req?.query?.trim().toLowerCase();- if (query === undefined || query === '') {- return providers;- }- return providers.filter(- provider => provider.name.toLowerCase().includes(query) || provider.id.toLowerCase().includes(query),- );+ return filterUiSandboxProviders({ providers, query: req?.query });},createSandboxProvider: async req => {const body = await client.settings.sandboxProviders.upsert({diff --git a/packages/trueforge-ui-sdk/src/server/types.ts b/packages/trueforge-ui-sdk/src/server/types.tsindex 207a25d24..d4b5ba2d7 100644--- a/packages/trueforge-ui-sdk/src/server/types.ts+++ b/packages/trueforge-ui-sdk/src/server/types.ts@@ -67,6 +67,8 @@ export type {SandboxProviderBase,SandboxProviderCatalogEntry,SandboxProviderConfig,+ SandboxProviderListEntry,+ SandboxSnapshotSyncStatus,SaveAgentRequest,SaveAgentResult,SearchAgentsParams,diff --git a/packages/trueforge-ui-sdk/test/containers/SettingsBuilder/SandboxSettings.test.tsx b/packages/trueforge-ui-sdk/test/containers/SettingsBuilder/SandboxSettings.test.tsxindex 884ee59ef..5ca026ba0 100644--- a/packages/trueforge-ui-sdk/test/containers/SettingsBuilder/SandboxSettings.test.tsx+++ b/packages/trueforge-ui-sdk/test/containers/SettingsBuilder/SandboxSettings.test.tsx@@ -1,7 +1,7 @@// @vitest-environment jsdom-import { fireEvent, render, screen, waitFor } from '@testing-library/react';+import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';import type { ReactNode } from 'react';-import { beforeAll, describe, expect, it } from 'vitest';+import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest';import SandboxSettings from '@/containers/SettingsBuilder/SandboxSettings.js';import { ServerProvider } from '@/server/ServerContext.js';@@ -9,6 +9,8 @@ import type {CreateSandboxProviderRequest,SandboxProviderBase,SandboxProviderCatalogEntry,+ SandboxProviderListEntry,+ SandboxSnapshotSyncStatus,UpdateSandboxProviderRequest,} from '@/server/types.js';import { createMockAgentUIServer, createMockCatalog } from '../../server/mockServer.js';@@ -22,25 +24,50 @@ beforeAll(() => {};});+afterEach(() => {+ vi.useRealTimers();+});+const catalogEntry: SandboxProviderCatalogEntry = {id: 'cat-daytona',name: 'Daytona',type: 'daytona',- snapshotName: 'daytona-default',execTimeoutMs: 300000,autoStopIntervalInMinutes: 15,autoArchiveIntervalInMinutes: 10080,autoDeleteIntervalInMinutes: 43200,};-function createFakeHost(initial: SandboxProviderBase[] = []) {+function sandboxEntry({+ provider,+ status = 'ready',+ statusReason,+}: {+ provider: SandboxProviderBase;+ status?: SandboxSnapshotSyncStatus['status'];+ statusReason?: string;+}): SandboxProviderListEntry {+ return {+ data: provider,+ snapshotSyncStatus: {+ status,+ ...(statusReason ? { statusReason } : {}),+ },+ };+}++function createFakeHost(initial: SandboxProviderListEntry[] = []) {let providers = [...initial];+ let listCalls = 0;const created: CreateSandboxProviderRequest[] = [];const updated: UpdateSandboxProviderRequest[] = [];const sandboxCatalog = {getSandboxProviderCatalog: async () => [catalogEntry],- listSandboxProviders: async () => providers,+ listSandboxProviders: async () => {+ listCalls += 1;+ return providers;+ },createSandboxProvider: async (req: CreateSandboxProviderRequest) => {created.push(req);const provider: SandboxProviderBase = {@@ -48,34 +75,35 @@ function createFakeHost(initial: SandboxProviderBase[] = []) {name: req.name,catalogId: req.catalogId,isConnected: true,- snapshotName: req.snapshotName,execTimeoutMs: req.execTimeoutMs,autoStopIntervalInMinutes: req.autoStopIntervalInMinutes,autoArchiveIntervalInMinutes: req.autoArchiveIntervalInMinutes,autoDeleteIntervalInMinutes: req.autoDeleteIntervalInMinutes,};- providers = [...providers, provider];+ providers = [...providers, sandboxEntry({ provider, status: 'pending' })];return provider;},updateSandboxProvider: async (req: UpdateSandboxProviderRequest) => {updated.push(req);- providers = providers.map(provider =>- provider.id === req.id+ providers = providers.map(entry =>+ entry.data.id === req.id? {- ...provider,- snapshotName: req.snapshotName,- execTimeoutMs: req.execTimeoutMs,- autoStopIntervalInMinutes: req.autoStopIntervalInMinutes,- autoArchiveIntervalInMinutes: req.autoArchiveIntervalInMinutes,- autoDeleteIntervalInMinutes: req.autoDeleteIntervalInMinutes,+ ...entry,+ data: {+ ...entry.data,+ execTimeoutMs: req.execTimeoutMs,+ autoStopIntervalInMinutes: req.autoStopIntervalInMinutes,+ autoArchiveIntervalInMinutes: req.autoArchiveIntervalInMinutes,+ autoDeleteIntervalInMinutes: req.autoDeleteIntervalInMinutes,+ },}- : provider,+ : entry,);- const next = providers.find(provider => provider.id === req.id);+ const next = providers.find(entry => entry.data.id === req.id);if (next === undefined) {throw new Error(`Sandbox provider "${req.id}" not found`);}- return next;+ return next.data;},};@@ -86,7 +114,11 @@ function createFakeHost(initial: SandboxProviderBase[] = []) {return {created,updated,+ getListCalls: () => listCalls,getProviders: () => providers,+ setProviders: (next: SandboxProviderListEntry[]) => {+ providers = next;+ },wrapper: ({ children }: { children: ReactNode }) => <ServerProvider server={server}>{children}</ServerProvider>,};}@@ -129,8 +161,6 @@ describe('SandboxSettings', () => {catalogId: 'cat-daytona',name: 'Daytona',type: 'daytona',- // Snapshot/image is release-owned now; the UI always sends an empty placeholder.- snapshotName: '',execTimeoutMs: 300000,autoStopIntervalInMinutes: 15,autoArchiveIntervalInMinutes: 10080,@@ -145,13 +175,12 @@ describe('SandboxSettings', () => {name: 'Daytona',catalogId: 'cat-daytona',isConnected: true,- snapshotName: 'custom-snap',execTimeoutMs: 60000,autoStopIntervalInMinutes: 30,autoArchiveIntervalInMinutes: 1440,autoDeleteIntervalInMinutes: 10080,};- const host = createFakeHost([existing]);+ const host = createFakeHost([sandboxEntry({ provider: existing })]);const { wrapper: Wrapper } = host;render(<Wrapper>@@ -181,7 +210,6 @@ describe('SandboxSettings', () => {});expect(host.updated[0]).toEqual({id: 'sb-1',- snapshotName: '',execTimeoutMs: 60000,autoStopIntervalInMinutes: 30,autoArchiveIntervalInMinutes: 1440,@@ -196,13 +224,12 @@ describe('SandboxSettings', () => {name: 'Daytona',catalogId: 'cat-daytona',isConnected: true,- snapshotName: 'custom-snap',execTimeoutMs: 60000,autoStopIntervalInMinutes: 30,autoArchiveIntervalInMinutes: 1440,autoDeleteIntervalInMinutes: 10080,};- const host = createFakeHost([existing]);+ const host = createFakeHost([sandboxEntry({ provider: existing })]);const { wrapper: Wrapper } = host;render(<Wrapper>@@ -218,4 +245,137 @@ describe('SandboxSettings', () => {expect(screen.queryByText(/^Available ·/)).toBeNull();expect(screen.queryByText('One provider is set up. Update it or remove it to switch.')).toBeNull();});++ it('renders pending and ready snapshot status badges', async () => {+ const provider: SandboxProviderBase = {+ id: 'sb-1',+ name: 'Daytona',+ catalogId: 'cat-daytona',+ isConnected: true,+ execTimeoutMs: 60000,+ autoStopIntervalInMinutes: 30,+ autoArchiveIntervalInMinutes: 1440,+ autoDeleteIntervalInMinutes: 10080,+ };+ const host = createFakeHost([+ sandboxEntry({+ provider,+ status: 'pending',+ statusReason: 'Snapshot build is queued',+ }),+ sandboxEntry({+ provider: { ...provider, id: 'sb-2', name: 'Daytona ready' },+ status: 'ready',+ }),+ ]);+ const { wrapper: Wrapper } = host;+ render(+ <Wrapper>+ <SandboxSettings />+ </Wrapper>,+ );++ await waitFor(() => {+ expect(screen.getByText('Syncing image...')).toBeTruthy();+ expect(screen.getByText('Connected')).toBeTruthy();+ });+ expect(screen.queryByRole('button', { name: 'Retry' })).toBeNull();++ fireEvent.mouseEnter(screen.getByLabelText('Snapshot sync status details'));+ await waitFor(() => {+ expect(screen.getByRole('tooltip')).toHaveTextContent('Snapshot build is queued');+ });+ });++ it('polls pending snapshot status every ten seconds until it changes', async () => {+ vi.useFakeTimers();+ const provider: SandboxProviderBase = {+ id: 'sb-1',+ name: 'Daytona',+ catalogId: 'cat-daytona',+ isConnected: true,+ execTimeoutMs: 60000,+ autoStopIntervalInMinutes: 30,+ autoArchiveIntervalInMinutes: 1440,+ autoDeleteIntervalInMinutes: 10080,+ };+ const host = createFakeHost([sandboxEntry({ provider, status: 'pending' })]);+ const { wrapper: Wrapper } = host;+ render(+ <Wrapper>+ <SandboxSettings />+ </Wrapper>,+ );++ await act(async () => {+ await vi.advanceTimersByTimeAsync(0);+ });+ expect(host.getListCalls()).toBe(1);++ host.setProviders([sandboxEntry({ provider, status: 'ready' })]);+ await act(async () => {+ await vi.advanceTimersByTimeAsync(9_999);+ });+ expect(host.getListCalls()).toBe(1);++ await act(async () => {+ await vi.advanceTimersByTimeAsync(1);+ });+ expect(host.getListCalls()).toBe(2);+ expect(screen.getByText('Connected')).toBeTruthy();++ await act(async () => {+ await vi.advanceTimersByTimeAsync(20_000);+ });+ expect(host.getListCalls()).toBe(2);+ });++ it('renders snapshot status badges and exposes failed status reason in a tooltip', async () => {+ const provider: SandboxProviderBase = {+ id: 'sb-1',+ name: 'Daytona',+ catalogId: 'cat-daytona',+ isConnected: true,+ execTimeoutMs: 60000,+ autoStopIntervalInMinutes: 30,+ autoArchiveIntervalInMinutes: 1440,+ autoDeleteIntervalInMinutes: 10080,+ };+ const host = createFakeHost([+ sandboxEntry({+ provider,+ status: 'failed',+ statusReason: 'Snapshot image could not be built',+ }),+ ]);+ const { wrapper: Wrapper } = host;+ render(+ <Wrapper>+ <SandboxSettings />+ </Wrapper>,+ );++ await waitFor(() => {+ expect(screen.getByText('Sync failed')).toBeTruthy();+ });+ expect(screen.queryByText('Connected')).toBeNull();++ fireEvent.mouseEnter(screen.getByLabelText('Snapshot sync status details'));+ await waitFor(() => {+ expect(screen.getByRole('tooltip')).toHaveTextContent('Snapshot image could not be built');+ });++ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));+ await waitFor(() => {+ expect(host.updated).toHaveLength(1);+ });+ expect(host.updated[0]).toEqual({+ id: 'sb-1',+ execTimeoutMs: 60000,+ autoStopIntervalInMinutes: 30,+ autoArchiveIntervalInMinutes: 1440,+ autoDeleteIntervalInMinutes: 10080,+ });+ expect(host.updated[0]).not.toHaveProperty('apiKey');+ });});diff --git a/packages/trueforge-ui-sdk/test/plugins/trueforge-agent-server-adapter/catalogs/sandboxProviderCatalog.test.ts b/packages/trueforge-ui-sdk/test/plugins/trueforge-agent-server-adapter/catalogs/sandboxProviderCatalog.test.tsindex a52d2ccc9..59948064f 100644--- a/packages/trueforge-ui-sdk/test/plugins/trueforge-agent-server-adapter/catalogs/sandboxProviderCatalog.test.ts+++ b/packages/trueforge-ui-sdk/test/plugins/trueforge-agent-server-adapter/catalogs/sandboxProviderCatalog.test.ts@@ -1,11 +1,14 @@+import { TrueForgeApi } from '@truefoundry/trueforge-sdk';import assert from 'node:assert/strict';import { describe, it } from 'vitest';import {configFromHarness,+ filterUiSandboxProviders,toHarnessManifest,toUiCatalogEntry,toUiSandboxProvider,+ toUiSandboxProviderListEntry,} from '@/plugins/trueforge-agent-server-adapter/catalogs/sandboxProviderCatalog.js';describe('sandboxProviderCatalog mappers', () => {@@ -22,6 +25,20 @@ describe('sandboxProviderCatalog mappers', () => {auth: { apiKey: 'dtn_secret' },};+ function configuredResponse({+ status,+ statusReason,+ }: {+ status: TrueForgeApi.SandboxBuildStatus;+ statusReason: string | null;+ }): TrueForgeApi.GetSandboxProviderResponse['data'] {+ return {+ manifest: harnessConfigured,+ status,+ statusReason,+ };+ }+// Snapshot/image is release-owned now; mappers emit an empty snapshotName only to satisfy// the external SandboxProviderConfig type, and toHarnessManifest omits it entirely.it('stamps catalog identity from type and strips auth', () => {@@ -29,7 +46,6 @@ describe('sandboxProviderCatalog mappers', () => {id: 'daytona',name: 'Daytona',type: 'daytona',- snapshotName: '',execTimeoutMs: 60000,autoStopIntervalInMinutes: 5,autoArchiveIntervalInMinutes: 60,@@ -43,7 +59,6 @@ describe('sandboxProviderCatalog mappers', () => {name: 'Daytona',catalogId: 'daytona',isConnected: true,- snapshotName: '',execTimeoutMs: 60000,autoStopIntervalInMinutes: 5,autoArchiveIntervalInMinutes: 60,@@ -53,6 +68,37 @@ describe('sandboxProviderCatalog mappers', () => {assert.equal('apiKey' in toUiSandboxProvider(harnessConfigured), false);});+ it('wraps configured providers with snapshot sync status', () => {+ for (const status of [+ TrueForgeApi.SandboxBuildStatus.Pending,+ TrueForgeApi.SandboxBuildStatus.Ready,+ TrueForgeApi.SandboxBuildStatus.Failed,+ ]) {+ const statusReason = status === TrueForgeApi.SandboxBuildStatus.Failed ? 'Snapshot build failed' : null;+ const entry = toUiSandboxProviderListEntry(configuredResponse({ status, statusReason }));++ assert.equal(entry.snapshotSyncStatus.status, status);+ assert.deepEqual(entry.data, toUiSandboxProvider(harnessConfigured));+ if (statusReason) {+ assert.equal(entry.snapshotSyncStatus.statusReason, statusReason);+ } else {+ assert.equal('statusReason' in entry.snapshotSyncStatus, false);+ }+ }+ });++ it('filters wrapped providers by provider identity', () => {+ const provider = toUiSandboxProviderListEntry(+ configuredResponse({+ status: TrueForgeApi.SandboxBuildStatus.Ready,+ statusReason: null,+ }),+ );++ assert.deepEqual(filterUiSandboxProviders({ providers: [provider], query: ' DAYT ' }), [provider]);+ assert.deepEqual(filterUiSandboxProviders({ providers: [provider], query: 'missing' }), []);+ });+it('round-trips config fields into harness upsert body without a snapshot name', () => {assert.deepEqual(toHarnessManifest({diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 509441fc9..62748cfd0 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -61,8 +61,8 @@ importers:specifier: 0.2.21version: 0.2.21(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])'@truefoundry/assistant-ui-runtime':- specifier: 0.1.16- version: 0.1.16(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))+ specifier: 0.1.17+ version: 0.1.17(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))'@truefoundry/trueforge-sdk':specifier: workspace:*version: link:../sdk@@ -368,8 +368,8 @@ importers:specifier: ^0.13.2version: 0.13.3(@openuidev/[email protected]([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected]))))(@openuidev/[email protected](@modelcontextprotocol/[email protected]([email protected])([email protected]))([email protected])([email protected]))(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))'@truefoundry/assistant-ui-runtime':- specifier: 0.1.16- version: 0.1.16(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))+ specifier: 0.1.17+ version: 0.1.17(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))'@truefoundry/trueforge-sdk':specifier: workspace:*version: link:../sdk@@ -3478,8 +3478,8 @@ packages:'@types/react-dom':optional: true- '@truefoundry/[email protected]':- resolution: {integrity: sha512-f90VorMg+Rfc0lv3/g4akLKBiWLNNUOsqh4yfd/NNgQfs2cKt6Zqd+nZQ01+xs6/oVaT0SuT8y6XxG7e/kv0TA==}+ '@truefoundry/[email protected]':+ resolution: {integrity: sha512-wk5GPcZ9gRdLX1o+nhSPBh/IWIJ0P0Q7vqp5Ziyme5bAh3940yyK0ZsNpasPpgFEcfqUnFYjoXyJBXJjzVyhig==}peerDependencies:'@types/react': '*'react: ^18 || ^19@@ -10619,7 +10619,7 @@ snapshots:'@types/react': 19.2.17'@types/react-dom': 19.2.3(@types/[email protected])- '@truefoundry/[email protected](@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))':+ '@truefoundry/[email protected](@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))':dependencies:'@assistant-ui/core': 0.2.22(@assistant-ui/[email protected](@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]))(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected](@types/[email protected])([email protected])([email protected]([email protected])))'@assistant-ui/store': 0.2.21(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])