@@ -679,6 +679,34 @@ function summarizeEmbeddedToolPayloadDocument(toolId = "", scopedToolState = nul
679679 return null ;
680680}
681681
682+ function resolveWorkspaceManifestToolStateForStatus ( toolId = "" ) {
683+ const normalizedToolId = normalizeTextValue ( toolId ) . toLowerCase ( ) ;
684+ if ( ! normalizedToolId ) {
685+ return null ;
686+ }
687+ const manifest = getManifest ( ) ;
688+ const tools = manifest && typeof manifest === "object" && manifest . tools && typeof manifest . tools === "object" && ! Array . isArray ( manifest . tools )
689+ ? manifest . tools
690+ : null ;
691+ if ( ! tools ) {
692+ return null ;
693+ }
694+
695+ const exactMatch = tools [ normalizedToolId ] ;
696+ if ( exactMatch && typeof exactMatch === "object" && ! Array . isArray ( exactMatch ) ) {
697+ return exactMatch ;
698+ }
699+
700+ if ( normalizedToolId === "palette-browser" ) {
701+ const singularPalette = tools . palette ;
702+ if ( singularPalette && typeof singularPalette === "object" && ! Array . isArray ( singularPalette ) ) {
703+ return singularPalette ;
704+ }
705+ }
706+
707+ return null ;
708+ }
709+
682710function installWorkspaceScopedSamplePresetFetchShim ( currentToolId , samplePresetPath ) {
683711 if ( typeof window === "undefined" || typeof window . fetch !== "function" ) {
684712 return ;
@@ -701,6 +729,7 @@ function installWorkspaceScopedSamplePresetFetchShim(currentToolId, samplePreset
701729 const rawPreset = await response . clone ( ) . json ( ) . catch ( ( ) => null ) ;
702730 const scopedPreset = selectWorkspaceScopedToolPreset ( rawPreset , normalizedToolId ) ;
703731 if ( ! scopedPreset ) {
732+ workspaceScopedToolPresetForStatus = null ;
704733 return response ;
705734 }
706735 workspaceScopedToolPresetForStatus = scopedPreset ;
@@ -728,16 +757,19 @@ async function primeWorkspaceScopedToolPresetForStatus(toolId, samplePresetPath)
728757 try {
729758 const response = await window . fetch ( normalizedSamplePresetPath , { cache : "no-store" } ) ;
730759 if ( ! response . ok ) {
760+ workspaceScopedToolPresetForStatus = null ;
731761 return null ;
732762 }
733763 const rawPreset = await response . json ( ) ;
734764 const scopedPreset = selectWorkspaceScopedToolPreset ( rawPreset , normalizedToolId ) ;
735765 if ( ! scopedPreset ) {
766+ workspaceScopedToolPresetForStatus = null ;
736767 return null ;
737768 }
738769 workspaceScopedToolPresetForStatus = scopedPreset ;
739770 return scopedPreset ;
740771 } catch {
772+ workspaceScopedToolPresetForStatus = null ;
741773 return null ;
742774 }
743775}
@@ -1435,9 +1467,11 @@ function isAssetCompatibleWithTool(toolId = "", asset = null) {
14351467
14361468function renderToolAssetBadge ( toolId = "" ) {
14371469 const normalizedToolId = normalizeTextValue ( toolId ) . toLowerCase ( ) ;
1470+ const workspaceBoundToolState = resolveWorkspaceManifestToolStateForStatus ( normalizedToolId ) ;
1471+ const statusSourceToolState = workspaceBoundToolState || workspaceScopedToolPresetForStatus ;
14381472 const embeddedPayloadSummary = summarizeEmbeddedToolPayloadDocument (
14391473 normalizedToolId ,
1440- workspaceScopedToolPresetForStatus
1474+ statusSourceToolState
14411475 ) ;
14421476 const acceptedKinds = resolveAcceptedAssetKindsForTool ( normalizedToolId ) ;
14431477 if ( normalizedToolId === "palette-browser" ) {
@@ -2228,6 +2262,7 @@ function ensureRuntimeMonitoring() {
22282262}
22292263
22302264async function initPlatformShell ( ) {
2265+ workspaceScopedToolPresetForStatus = null ;
22312266 ensureRuntimeMonitoring ( ) ;
22322267
22332268 const currentToolId = document . body . dataset . toolId || "" ;
0 commit comments