MCPcopy Create free account
hub / github.com/dwgx/WindsurfAPI / decodeNativeToolConfigRawPayload

Function decodeNativeToolConfigRawPayload

src/windsurf.js:744–763  ·  view source on GitHub ↗
(rawValue)

Source from the content-addressed store, hash-verified

742}
743
744function decodeNativeToolConfigRawPayload(rawValue) {
745 let value = String(rawValue || '').trim();
746 let mode = 'hex';
747 if (value.toLowerCase().startsWith('hex:')) {
748 value = value.slice(4).trim();
749 } else if (value.toLowerCase().startsWith('base64:')) {
750 mode = 'base64';
751 value = value.slice(7).trim();
752 }
753 const buf = mode === 'base64'
754 ? Buffer.from(value, 'base64')
755 : Buffer.from(value.replace(/\s+/g, ''), 'hex');
756 if (buf.length > 512) {
757 throw new Error('WINDSURFAPI_NATIVE_TOOL_BRIDGE_CONFIG_RAW entry exceeds 512 bytes');
758 }
759 if (!buf.length && value) {
760 throw new Error('WINDSURFAPI_NATIVE_TOOL_BRIDGE_CONFIG_RAW entry did not decode to bytes');
761 }
762 return buf;
763}
764
765function nativeToolConfigSwitches(list) {
766 const names = new Set((Array.isArray(list) ? list : [])

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected