diff --git a/app/components/InferenceEndpointPanel.tsx b/app/components/InferenceEndpointPanel.tsx index e467024..d4d3b97 100644 --- a/app/components/InferenceEndpointPanel.tsx +++ b/app/components/InferenceEndpointPanel.tsx @@ -144,7 +144,7 @@ export default function InferenceEndpointPanel() { function useNvidiaInferencePreset() { setName("nvidia-inference") setType("openai") - setModel("us/aws/anthropic/bedrock-claude-opus-4-6") + setModel("aws/anthropic/claude-opus-4-5") setBaseUrl("https://inference-api.nvidia.com/v1") setCredentialKey("NVIDIA_API_KEY") setRoute("gateway") diff --git a/app/components/SandboxInferencePanel.tsx b/app/components/SandboxInferencePanel.tsx index 6d36a22..cb1bd65 100644 --- a/app/components/SandboxInferencePanel.tsx +++ b/app/components/SandboxInferencePanel.tsx @@ -9,6 +9,14 @@ type ProviderSummary = { type: string | null } +type InferenceRouteStatus = { + configured: boolean + provider: string | null + model: string | null + version: string | null + timeout: string | null +} + type OllamaModel = { name: string sizeLabel: string | null @@ -68,6 +76,7 @@ export default function SandboxInferencePanel({ const [applying, setApplying] = useState(false) const [message, setMessage] = useState("") const [providers, setProviders] = useState([]) + const [verifiedRoutes, setVerifiedRoutes] = useState>([]) const [routes, setRoutes] = useState([]) const [primaryRouteId, setPrimaryRouteId] = useState("") const [draftProvider, setDraftProvider] = useState("") @@ -111,8 +120,18 @@ export default function SandboxInferencePanel({ const nextProviders = Array.isArray(inferenceData.providers) ? inferenceData.providers : [] const config = configData.config as SandboxInferenceConfig - const fallbackProvider = inferenceData.gateway?.provider || nextProviders[0]?.name || "" - const fallbackModel = inferenceData.gateway?.model || "" + const gatewayRoute = inferenceData.gateway as InferenceRouteStatus | undefined + const systemRoute = inferenceData.system as InferenceRouteStatus | undefined + const nextVerifiedRoutes = [ + gatewayRoute?.configured && gatewayRoute.provider && gatewayRoute.model + ? { ...makeRoute(gatewayRoute.provider, gatewayRoute.model, "Active sandbox route"), scope: "Sandbox" as const } + : null, + systemRoute?.configured && systemRoute.provider && systemRoute.model + ? { ...makeRoute(systemRoute.provider, systemRoute.model, "Active system route"), scope: "System" as const } + : null, + ].filter((route): route is SandboxInferenceRoute & { scope: "Sandbox" | "System" } => Boolean(route)) + const fallbackProvider = gatewayRoute?.provider || nextProviders[0]?.name || "" + const fallbackModel = gatewayRoute?.model || "" const nextRoutes = dedupeRoutes(Array.isArray(config?.routes) && config.routes.length > 0 ? config.routes : fallbackProvider && fallbackModel @@ -120,6 +139,7 @@ export default function SandboxInferencePanel({ : []) setProviders(nextProviders) + setVerifiedRoutes(nextVerifiedRoutes) setRoutes(nextRoutes) setPrimaryRouteId(config?.primaryRouteId || nextRoutes[0]?.id || "") setDraftProvider(fallbackProvider) @@ -273,6 +293,32 @@ export default function SandboxInferencePanel({ )} + {verifiedRoutes.length > 0 && ( +
+
+
Verified Working Routes
+ OpenShell active +
+
+ {verifiedRoutes.map((route) => ( + + ))} +
+
+ )} +
diff --git a/app/components/SandboxList.tsx b/app/components/SandboxList.tsx index 5f2f56d..037276e 100644 --- a/app/components/SandboxList.tsx +++ b/app/components/SandboxList.tsx @@ -1,5 +1,5 @@ "use client" -import { useEffect, useState } from 'react' +import { useCallback, useEffect, useState } from 'react' import type { ReactNode } from 'react' import ConfigurationPanel from './ConfigurationPanel' import SandboxArchivePanel from './SandboxArchivePanel' @@ -150,34 +150,35 @@ export default function SandboxList({ } }, [selectedSandboxId]) + const loadPermissionFeed = useCallback(async (sandbox: SandboxInventoryItem) => { + try { + const response = await fetch(`/api/sandbox/${encodeURIComponent(sandbox.id)}/permissions`, { cache: 'no-store' }) + const data = await response.json() + const feed = response.ok ? data.feed : { rejectedCount: 1, latest: { status: 'Unavailable', error: data.error } } + setPermissionFeeds((current) => ({ ...current, [sandbox.id]: feed })) + } catch (error) { + setPermissionFeeds((current) => ({ + ...current, + [sandbox.id]: { rejectedCount: 1, latest: { status: 'Unavailable', error: error instanceof Error ? error.message : 'Permission feed unavailable' } }, + })) + } + }, []) + useEffect(() => { if (sandboxes.length === 0) { setPermissionFeeds({}) return } - - let active = true - const loadPermissionFeeds = async () => { - const entries = await Promise.all(sandboxes.map(async (sandbox) => { - try { - const response = await fetch(`/api/sandbox/${encodeURIComponent(sandbox.id)}/permissions`, { cache: 'no-store' }) - const data = await response.json() - return [sandbox.id, response.ok ? data.feed : { rejectedCount: 1, latest: { status: 'Unavailable', error: data.error } }] as const - } catch (error) { - return [sandbox.id, { rejectedCount: 1, latest: { status: 'Unavailable', error: error instanceof Error ? error.message : 'Permission feed unavailable' } }] as const - } - })) - if (active) setPermissionFeeds(Object.fromEntries(entries)) - } - - loadPermissionFeeds() - const interval = window.setInterval(loadPermissionFeeds, 12000) - return () => { - active = false - window.clearInterval(interval) - } + setPermissionFeeds((current) => Object.fromEntries( + Object.entries(current).filter(([sandboxId]) => sandboxes.some((sandbox) => sandbox.id === sandboxId)), + )) }, [sandboxes]) + useEffect(() => { + if (!selectedSandbox || !openDrawers.policy || permissionFeeds[selectedSandbox.id]) return + loadPermissionFeed(selectedSandbox) + }, [loadPermissionFeed, openDrawers.policy, permissionFeeds, selectedSandbox]) + useEffect(() => { let active = true const loadMcpAccess = async () => { @@ -232,7 +233,11 @@ export default function SandboxList({ } const toggleDrawer = (key: DrawerKey) => { + const opening = !openDrawers[key] setOpenDrawers((current) => ({ ...current, [key]: !current[key] })) + if (key === 'policy' && opening && selectedSandbox) { + loadPermissionFeed(selectedSandbox) + } } const sandboxCanAccessMcpServer = (sandbox: SandboxInventoryItem, server: McpServerAccess) => { @@ -677,6 +682,20 @@ export default function SandboxList({ onToggle={() => toggleDrawer('policy')} >
+
+
+

Network Permission Feed

+

Loaded on demand for the selected sandbox to avoid background permission polling.

+
+ +
{(() => { const feed = permissionFeeds[selectedSandbox.id] const pending = feed?.pending || [] diff --git a/tests/sandbox-lifecycle-check.mjs b/tests/sandbox-lifecycle-check.mjs index 8835039..36d1e56 100644 --- a/tests/sandbox-lifecycle-check.mjs +++ b/tests/sandbox-lifecycle-check.mjs @@ -74,7 +74,7 @@ assert.match(inferenceRouteSource, /\["inference", "set", "--provider", name, "- assert.match(inferenceRouteSource, /OPENAI_BASE_URL=\$\{baseUrl\}/, 'inference route must pass endpoint URL as provider config') assert.match(inferencePanelSource, /INFERENCE ENDPOINTS/, 'settings UI must expose inference endpoint configuration') assert.match(inferencePanelSource, /https:\/\/inference-api\.nvidia\.com\/v1/, 'settings UI must provide the NVIDIA inference API preset') -assert.match(inferencePanelSource, /bedrock-claude-opus-4-6/, 'settings UI must include the requested NVIDIA inference model preset') +assert.match(inferencePanelSource, /aws\/anthropic\/claude-opus-4-5/, 'settings UI must include the requested NVIDIA inference model preset') assert.match(inferencePanelSource, /method: "DELETE"/, 'settings UI must expose provider deletion') assert.match(inferencePanelSource, /\/api\/ollama\/models/, 'settings UI must poll local Ollama models') assert.match(inferencePanelSource, /window\.setInterval\(\(\) => loadOllamaModels\(\{ silent: true \}\), 10000\)/, 'settings UI must autopoll Ollama while selected') @@ -85,6 +85,8 @@ assert.match(sandboxInferenceRouteSource, /primaryRouteId/, 'sandbox inference r assert.match(sandboxInferenceRouteSource, /saveSandboxInferenceConfig/, 'sandbox inference route must persist per-sandbox inference profiles') assert.match(sandboxInferencePanelSource, /Save Sandbox Routes/, 'selected sandbox UI must expose multi-route inference saving') assert.match(sandboxInferencePanelSource, /Apply to Running Container/, 'selected sandbox UI must expose live apply for running containers') +assert.match(sandboxInferencePanelSource, /Verified Working Routes/, 'selected sandbox UI must list verified active inference routes') +assert.match(sandboxInferencePanelSource, /inferenceData\.system/, 'selected sandbox UI must include system route status when available') assert.match(sandboxInferencePanelSource, /\/api\/sandbox\/\$\{encodeURIComponent\(sandbox\.id\)\}\/inference/, 'selected sandbox UI must load and save sandbox-specific inference profiles') assert.match(sandboxInferencePanelSource, /\/api\/sandbox\/\$\{encodeURIComponent\(sandbox\.id\)\}\/inference\/apply/, 'selected sandbox UI must call live apply endpoint') assert.match(sandboxInferencePanelSource, /\/api\/ollama\/models/, 'selected sandbox UI must offer Ollama model selection') @@ -97,6 +99,8 @@ assert.match(sandboxRestartRouteSource, /\["delete", "pod", sandboxName, "-n", O assert.match(sandboxRestartRouteSource, /waitForSandboxReady\(sandboxName, 90000, 2000\)/, 'restart route must wait for OpenShell to report the sandbox ready') assert.match(sandboxListSource, /Restart Sandbox/, 'sandbox details must expose a restart sandbox button') assert.match(sandboxListSource, /\/api\/sandbox\/\$\{encodeURIComponent\(selectedSandbox\.id\)\}\/restart/, 'restart button must call the sandbox restart endpoint') +assert.doesNotMatch(sandboxListSource, /setInterval\(loadPermissionFeeds/, 'sandbox list must not poll every sandbox permission feed') +assert.match(sandboxListSource, /loadPermissionFeed\(selectedSandbox\)/, 'policy drawer must load the selected sandbox permission feed on demand') assert.match(sandboxListSource, /Inference/, 'settings view must render inference endpoint panel')