@@ -22,7 +22,6 @@ const HEADER_EXPANDED_STORAGE_KEY = "toolboxaid.toolsPlatform.headerExpanded";
2222const HEADER_EXPANDED_FALLBACK_TOOL = "tool-host" ;
2323const TOOLS_PLATFORM_LOGGER = new Logger ( { channel : "tools.platform" , level : "debug" } ) ;
2424const TOOLS_PLATFORM_BOOT_MS = Date . now ( ) ;
25- const APPLIED_PRESET_KEY = "__TOOLS_PLATFORM_PHASE20_PRESET_APPLIED__" ;
2625
2726function getPageMode ( ) {
2827 return document . body . dataset . toolsPlatformPage || "tool" ;
@@ -731,53 +730,6 @@ function ensureRuntimeMonitoring() {
731730 } , { once : true } ) ;
732731}
733732
734- function decodeSamplePresetPayload ( encoded ) {
735- if ( typeof encoded !== "string" || ! encoded . trim ( ) ) {
736- return null ;
737- }
738- try {
739- const base64 = encoded . replace ( / - / g, "+" ) . replace ( / _ / g, "/" ) ;
740- const padded = `${ base64 } ${ "=" . repeat ( ( 4 - ( base64 . length % 4 ) ) % 4 ) } ` ;
741- const jsonText = atob ( padded ) ;
742- const parsed = JSON . parse ( jsonText ) ;
743- return parsed && typeof parsed === "object" ? parsed : null ;
744- } catch {
745- return null ;
746- }
747- }
748-
749- function readPhase20PresetFromLocation ( currentToolId = "" ) {
750- if ( typeof window === "undefined" ) {
751- return null ;
752- }
753- const params = new URLSearchParams ( window . location . search ) ;
754- const samplePreset = decodeSamplePresetPayload ( params . get ( "samplePreset" ) || "" ) ;
755- if ( ! samplePreset || samplePreset . toolId !== currentToolId || ! samplePreset . state || typeof samplePreset . state !== "object" ) {
756- return null ;
757- }
758- return {
759- sampleId : typeof samplePreset . sampleId === "string" ? samplePreset . sampleId : "" ,
760- label : typeof samplePreset . label === "string" ? samplePreset . label : "" ,
761- state : samplePreset . state
762- } ;
763- }
764-
765- function maybeApplyPhase20Preset ( currentToolId = "" ) {
766- if ( ! workspaceController || ! currentToolId || window [ APPLIED_PRESET_KEY ] === true ) {
767- return ;
768- }
769- const preset = readPhase20PresetFromLocation ( currentToolId ) ;
770- if ( ! preset ) {
771- return ;
772- }
773- const label = preset . label || `Phase 20 sample ${ preset . sampleId || "preset" } ` ;
774- workspaceController . applyExternalToolState ( {
775- state : preset . state ,
776- label
777- } ) ;
778- window [ APPLIED_PRESET_KEY ] = true ;
779- }
780-
781733function initPlatformShell ( ) {
782734 ensureRuntimeMonitoring ( ) ;
783735
@@ -821,7 +773,6 @@ function initPlatformShell() {
821773 }
822774 } ) ;
823775 workspaceController . startWatching ( ) ;
824- maybeApplyPhase20Preset ( currentToolId ) ;
825776 }
826777
827778 renderShell ( currentTool ) ;
0 commit comments