@agentic-ui-experience/ui-mcp 0.0.1-beta.6 → 0.0.1-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/client.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
(function(_0x3139ef,_0x2bf974){const _0x4521a4=_0x2989,_0x354e86=_0x3139ef();while(!![]){try{const _0x30100b=parseInt(_0x4521a4(0x154))/0x1+parseInt(_0x4521a4(0x13d))/0x2*(-parseInt(_0x4521a4(0x16f))/0x3)+-parseInt(_0x4521a4(0x153))/0x4*(-parseInt(_0x4521a4(0x14f))/0x5)+parseInt(_0x4521a4(0x15e))/0x6*(parseInt(_0x4521a4(0x13a))/0x7)+-parseInt(_0x4521a4(0x13b))/0x8+parseInt(_0x4521a4(0x14c))/0x9+parseInt(_0x4521a4(0x15b))/0xa;if(_0x30100b===_0x2bf974)break;else _0x354e86['push'](_0x354e86['shift']());}catch(_0x4c0ca7){_0x354e86['push'](_0x354e86['shift']());}}}(_0x1a41,0x42d8f));import{createServer}from'node:http';import{resolve}from'node:path';import{pathToFileURL}from'node:url';import{parseArgs}from'node:util';import{A2UI_SUPPORTED_PROTOCOL_VERSIONS}from'@agentic-ui-experience/ui-core';import{StreamableHTTPServerTransport}from'@modelcontextprotocol/sdk/server/streamableHttp.js';function _0x2989(_0x3fa84f,_0x278c51){_0x3fa84f=_0x3fa84f-0x135;const _0x1a41d1=_0x1a41();let _0x298995=_0x1a41d1[_0x3fa84f];return _0x298995;}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{createUIMCPServer}from'./index.js';const helpText='@agentic-ui-experience/ui-mcp\x0a\x0aUsage:\x0a\x20\x20ax-ui-mcp\x20[options]\x0a\x0aOptions:\x0a\x20\x20--transport\x20<stdio|http>\x20\x20\x20\x20\x20\x20MCP\x20transport\x20to\x20start.\x20Default:\x20stdio\x0a\x20\x20--host\x20<host>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20HTTP\x20bind\x20host.\x20Default:\x20127.0.0.1\x0a\x20\x20--port\x20<port>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20HTTP\x20bind\x20port.\x20Default:\x203001\x0a\x20\x20--endpoint\x20<path>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20HTTP\x20MCP\x20endpoint.\x20Default:\x20/mcp\x0a\x20\x20--cors-origin\x20<origin>\x20\x20\x20\x20\x20\x20\x20\x20Allow\x20a\x20browser\x20origin.\x20Repeatable.\x20Use\x20\x22*\x22\x20for\x20development.\x0a\x20\x20--catalog\x20<module>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ESM\x20module\x20exporting\x20the\x20CatalogPromptDescriptor\x20to\x20serve.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Defaults\x20to\x20the\x20A2UI\x20basic\x20catalog.\x0a\x20\x20--schema-delivery\x20<discovery|inline>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Default:\x20discovery\x20(get_ui_catalog\x20+\x20send_ui_to_client).\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Inline\x20exposes\x20only\x20send_ui_to_client,\x20with\x20its\x20full\x20inputSchema.\x0a\x20\x20--protocol-version\x20<v0.9.1>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20A2UI\x20version\x20requested\x20in\x20generated\x20UI.\x20Default:\x20v0.9.1\x0a\x20\x20--name\x20<name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20MCP\x20server\x20name.\x20Default:\x20@agentic-ui-experience/ui-mcp\x0a\x20\x20--version\x20<version>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20MCP\x20server\x20version.\x20Default:\x200.0.0\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help.\x0a\x0aA\x20server\x20serves\x20exactly\x20one\x20catalog,\x20matching\x20A2UI\x27s\x20model\x20where\x20a\x20surface\x27s\x0acatalog\x20is\x20fixed\x20at\x20createSurface\x20time.\x20Combine\x20vocabularies\x20when\x20you\x20define\x20the\x0acatalog,\x20not\x20at\x20runtime.\x0a\x0aA2UI\x20clients\x20must\x20declare\x20clientCapabilities[\x22v0.9\x22].supportedCatalogIds\x20with\x0athis\x20server\x27s\x20exact\x20Catalog\x20ID.\x20Stateful\x20clients\x20send\x20it\x20in\x20initialize\x0acapabilities.a2ui.\x20This\x20HTTP\x20server\x20is\x20stateless,\x20so\x20every\x20send_ui_to_client\x20call\x0amust\x20also\x20carry\x20the\x20declaration\x20in\x20_meta.a2ui.\x0a\x0aCatalog\x20modules\x20may\x20export\x20one\x20of:\x0a\x20\x20export\x20default\x20descriptor\x0a\x20\x20export\x20const\x20catalog\x20=\x20descriptor\x0a';function stringValue(_0x46ba04,_0x3f6cdb){const _0x5852cf=_0x2989;return typeof _0x46ba04==='string'&&_0x46ba04[_0x5852cf(0x144)]>0x0?_0x46ba04:_0x3f6cdb;}function optionalStringValue(_0x267f21){return typeof _0x267f21==='string'&&_0x267f21['length']>0x0?_0x267f21:void 0x0;}function stringArrayValue(_0x411c9e){const _0x15141f=_0x2989;if(Array['isArray'](_0x411c9e))return _0x411c9e;if(typeof _0x411c9e===_0x15141f(0x16c)&&_0x411c9e[_0x15141f(0x144)]>0x0)return[_0x411c9e];return[];}function parseTransport(_0x561da9){const _0x32441b=_0x2989;if(_0x561da9==='stdio'||_0x561da9===_0x32441b(0x138))return _0x561da9;throw new Error(_0x32441b(0x14a)+_0x561da9+'\x22.\x20Expected\x20\x22stdio\x22\x20or\x20\x22http\x22.');}function parseSchemaDelivery(_0x545a42){const _0x2e51cf=_0x2989;if(_0x545a42===_0x2e51cf(0x158)||_0x545a42===_0x2e51cf(0x150))return _0x545a42;throw new Error('Unsupported\x20schema\x20delivery\x20\x22'+_0x545a42+'\x22.\x20Expected\x20\x22discovery\x22\x20or\x20\x22inline\x22.');}function _0x1a41(){const _0x5721fe=['connect','pathname','port','url','Unsupported\x20transport\x20\x22','write','1710225UZRLcx','[@agentic-ui-experience/ui-mcp]\x20request\x20failed','localhost','10KhgCKh','inline','protocolVersion','once','358404toICtG','58260OyakaS','href','map','\x22\x20did\x20not\x20export\x20a\x20catalog\x20descriptor.','discovery','close','message','4618410aofNFN','end','method','986532SYNbIs','Not\x20Found','exit','catalog','endpoint','\x22\x20exported\x20','object','name','stdout','Vary','values','stdio','corsOrigins','Access-Control-Allow-Methods','string','cors-origin','\x22.\x20Expected\x20an\x20integer\x20from\x201\x20to\x2065535.','24NJjaze','protocol-version','listen','host','isArray','http://','http','error','14ivQhxt','4133352CBgGbW','127.0.0.1','106924EbvcsK','origin','\x22\x20exported\x20an\x20invalid\x20catalog\x20descriptor.','handleRequest','setHeader','stderr','Content-Type,\x20Accept,\x20Authorization,\x20MCP-Protocol-Version,\x20Mcp-Session-Id,\x20Last-Event-ID','length','statusCode'];_0x1a41=function(){return _0x5721fe;};return _0x1a41();}function parseProtocolVersion(_0x4ac122){const _0xbcdf62=_0x2989;if(A2UI_SUPPORTED_PROTOCOL_VERSIONS['some'](_0x3d2791=>_0x3d2791===_0x4ac122))return _0x4ac122;throw new Error('Unsupported\x20protocol\x20version\x20\x22'+_0x4ac122+'\x22.\x20Expected\x20'+A2UI_SUPPORTED_PROTOCOL_VERSIONS[_0xbcdf62(0x156)](_0x21696c=>'\x22'+_0x21696c+'\x22')['join']('\x20or\x20')+'.');}function parsePort(_0x1da2ea){const _0x50a7d9=_0x2989,_0x55bf43=Number(_0x1da2ea);if(!Number['isInteger'](_0x55bf43)||_0x55bf43<0x1||_0x55bf43>0xffff)throw new Error('Invalid\x20--port\x20\x22'+_0x1da2ea+_0x50a7d9(0x16e));return _0x55bf43;}function normalizeEndpoint(_0x98b25c){if(!_0x98b25c['startsWith']('/'))return'/'+_0x98b25c;return _0x98b25c;}function isCatalogDescriptor(_0x5c9fa1){const _0x4adeeb=_0x2989;return!!_0x5c9fa1&&typeof _0x5c9fa1===_0x4adeeb(0x164)&&!Array['isArray'](_0x5c9fa1)&&typeof _0x5c9fa1['id']===_0x4adeeb(0x16c)&&Array['isArray'](_0x5c9fa1['baseComponentNames']);}function readCatalogExport(_0x5d1764,_0x4cbdad){const _0x28d328=_0x2989,_0x6af1cc=_0x5d1764['catalogs']??_0x5d1764[_0x28d328(0x161)]??_0x5d1764['default'];if(Array[_0x28d328(0x136)](_0x6af1cc)){if(_0x6af1cc[_0x28d328(0x144)]!==0x1)throw new Error('Catalog\x20module\x20\x22'+_0x4cbdad+_0x28d328(0x163)+_0x6af1cc[_0x28d328(0x144)]+'\x20catalogs.\x20A\x20server\x20serves\x20exactly\x20one;\x20merge\x20them\x20into\x20a\x20single\x20descriptor.');const [_0x263190]=_0x6af1cc;if(!isCatalogDescriptor(_0x263190))throw new Error('Catalog\x20module\x20\x22'+_0x4cbdad+_0x28d328(0x13f));return _0x263190;}if(_0x6af1cc===void 0x0)throw new Error('Catalog\x20module\x20\x22'+_0x4cbdad+_0x28d328(0x157));if(!isCatalogDescriptor(_0x6af1cc))throw new Error('Catalog\x20module\x20\x22'+_0x4cbdad+_0x28d328(0x13f));return _0x6af1cc;}async function loadCatalog(_0x54cbfb){const _0x280e52=_0x2989;if(_0x54cbfb===void 0x0)return void 0x0;const _0x5d6aed=await import(pathToFileURL(resolve(_0x54cbfb))[_0x280e52(0x155)]);return readCatalogExport(_0x5d6aed,_0x54cbfb);}async function parseCliOptions(){const _0x348cd4=_0x2989,_0x235e35=parseArgs({'allowPositionals':![],'options':{'transport':{'type':_0x348cd4(0x16c)},'host':{'type':'string'},'port':{'type':'string'},'endpoint':{'type':_0x348cd4(0x16c)},'cors-origin':{'type':'string','multiple':!![]},'catalog':{'type':_0x348cd4(0x16c)},'schema-delivery':{'type':'string'},'protocol-version':{'type':'string'},'name':{'type':_0x348cd4(0x16c)},'version':{'type':'string'},'help':{'type':'boolean','short':'h'}}});_0x235e35[_0x348cd4(0x168)]['help']&&(process[_0x348cd4(0x166)][_0x348cd4(0x14b)](helpText),process[_0x348cd4(0x160)](0x0));const _0x3fffd2=parseSchemaDelivery(_0x235e35['values']['schema-delivery']??'discovery'),_0x10af34=await loadCatalog(optionalStringValue(_0x235e35[_0x348cd4(0x168)]['catalog'])),_0x24c934=optionalStringValue(_0x235e35['values'][_0x348cd4(0x170)]);return{'transport':parseTransport(stringValue(_0x235e35[_0x348cd4(0x168)]['transport'],_0x348cd4(0x169))),'host':stringValue(_0x235e35[_0x348cd4(0x168)]['host'],_0x348cd4(0x13c)),'port':parsePort(stringValue(_0x235e35[_0x348cd4(0x168)]['port'],'3001')),'endpoint':normalizeEndpoint(stringValue(_0x235e35['values'][_0x348cd4(0x162)],'/mcp')),'corsOrigins':stringArrayValue(_0x235e35['values'][_0x348cd4(0x16d)]),..._0x10af34?{'catalog':_0x10af34}:{},'schemaDelivery':_0x3fffd2,..._0x24c934?{'protocolVersion':parseProtocolVersion(_0x24c934)}:{},...optionalStringValue(_0x235e35['values']['name'])?{'serverName':optionalStringValue(_0x235e35[_0x348cd4(0x168)][_0x348cd4(0x165)])}:{},...optionalStringValue(_0x235e35['values']['version'])?{'serverVersion':optionalStringValue(_0x235e35[_0x348cd4(0x168)]['version'])}:{}};}function createServerOptions(_0x409cf8){const _0x1df27c=_0x2989;return{..._0x409cf8['catalog']?{'catalog':_0x409cf8[_0x1df27c(0x161)]}:{},'schemaDelivery':_0x409cf8['schemaDelivery'],..._0x409cf8[_0x1df27c(0x151)]?{'protocolVersion':_0x409cf8[_0x1df27c(0x151)]}:{},'server':{..._0x409cf8['serverName']?{'name':_0x409cf8['serverName']}:{},..._0x409cf8['serverVersion']?{'version':_0x409cf8['serverVersion']}:{}}};}function setCorsHeaders(_0x36c583,_0x3496fc,_0x4918f3){const _0x2d654e=_0x2989;if(_0x4918f3['length']===0x0)return;const _0x50e7ee=_0x36c583['headers'][_0x2d654e(0x13e)],_0x2bcc44=_0x4918f3['includes']('*'),_0xe8ce10=_0x2bcc44?'*':typeof _0x50e7ee==='string'&&_0x4918f3['includes'](_0x50e7ee)?_0x50e7ee:void 0x0;if(!_0xe8ce10)return;_0x3496fc[_0x2d654e(0x141)]('Access-Control-Allow-Origin',_0xe8ce10),_0x3496fc[_0x2d654e(0x141)](_0x2d654e(0x167),'Origin'),_0x3496fc['setHeader'](_0x2d654e(0x16b),'GET,POST,DELETE,OPTIONS'),_0x3496fc['setHeader']('Access-Control-Allow-Headers',_0x2d654e(0x143)),_0x3496fc[_0x2d654e(0x141)]('Access-Control-Expose-Headers','Mcp-Session-Id');}function writeJsonRpcError(_0x6dafc4,_0x58693d,_0x446720){const _0x5c11d5=_0x2989;_0x6dafc4['statusCode']=_0x58693d,_0x6dafc4[_0x5c11d5(0x141)]('content-type','application/json'),_0x6dafc4['end'](JSON['stringify']({'jsonrpc':'2.0','error':{'code':-0x7f5b,'message':_0x446720},'id':null}));}async function startStdio(_0x1dc3e0){const _0x13d946=createUIMCPServer(createServerOptions(_0x1dc3e0));await _0x13d946['connect'](new StdioServerTransport());}async function startHttp(_0x590c80){const _0x5ee1f7=_0x2989,_0x4da773=createServer(async(_0x32c730,_0x1d4032)=>{const _0x1cbd49=_0x2989,_0x1d1f15=new URL(_0x32c730[_0x1cbd49(0x149)]??'/',_0x1cbd49(0x137)+(_0x32c730['headers'][_0x1cbd49(0x135)]??_0x1cbd49(0x14e)));if(_0x1d1f15[_0x1cbd49(0x147)]!==_0x590c80['endpoint']){_0x1d4032[_0x1cbd49(0x145)]=0x194,_0x1d4032['end'](_0x1cbd49(0x15f));return;}setCorsHeaders(_0x32c730,_0x1d4032,_0x590c80[_0x1cbd49(0x16a)]);if(_0x32c730[_0x1cbd49(0x15d)]==='OPTIONS'){_0x1d4032[_0x1cbd49(0x145)]=0xcc,_0x1d4032[_0x1cbd49(0x15c)]();return;}try{const _0x360d30=createUIMCPServer(createServerOptions(_0x590c80)),_0x1d9d50=new StreamableHTTPServerTransport({'sessionIdGenerator':void 0x0});await _0x360d30[_0x1cbd49(0x146)](_0x1d9d50),await _0x1d9d50[_0x1cbd49(0x140)](_0x32c730,_0x1d4032),_0x1d4032['on']('close',()=>{const _0x11072d=_0x1cbd49;void _0x1d9d50['close'](),void _0x360d30[_0x11072d(0x159)]();});}catch(_0xd3506e){console[_0x1cbd49(0x139)](_0x1cbd49(0x14d),_0xd3506e),!_0x1d4032['headersSent']&&writeJsonRpcError(_0x1d4032,0x1f4,_0xd3506e instanceof Error?_0xd3506e['message']:'Internal\x20MCP\x20server\x20error');}});await new Promise((_0x13ed9c,_0x504d6f)=>{const _0x5f471b=_0x2989;_0x4da773[_0x5f471b(0x152)](_0x5f471b(0x139),_0x504d6f),_0x4da773[_0x5f471b(0x171)](_0x590c80[_0x5f471b(0x148)],_0x590c80['host'],_0x13ed9c);});const _0x4f3dcc=()=>{const _0xf46ae0=_0x2989;_0x4da773[_0xf46ae0(0x159)](()=>process['exit'](0x0));};process[_0x5ee1f7(0x152)]('SIGINT',_0x4f3dcc),process['once']('SIGTERM',_0x4f3dcc),process[_0x5ee1f7(0x142)]['write']('@agentic-ui-experience/ui-mcp\x20listening\x20on\x20http://'+_0x590c80['host']+':'+_0x590c80[_0x5ee1f7(0x148)]+_0x590c80[_0x5ee1f7(0x162)]+'\x0a');}async function main(){const _0xc4acbc=_0x2989,_0x2d3726=await parseCliOptions();if(_0x2d3726['transport']===_0xc4acbc(0x169)){await startStdio(_0x2d3726);return;}await startHttp(_0x2d3726);}main()['catch'](_0x5a5a69=>{const _0x292495=_0x2989;process['stderr']['write']((_0x5a5a69 instanceof Error?_0x5a5a69[_0x292495(0x15a)]:String(_0x5a5a69))+'\x0a'),process[_0x292495(0x160)](0x1);});
|
|
2
|
+
function _0x109b(){const _0x461cf5=['2.0','OPTIONS','Vary','@agentic-ui-experience/ui-mcp\x0a\x0aUsage:\x0a\x20\x20ax-ui-mcp\x20[options]\x0a\x0aOptions:\x0a\x20\x20--transport\x20<stdio|http>\x20\x20\x20\x20\x20\x20MCP\x20transport\x20to\x20start.\x20Default:\x20stdio\x0a\x20\x20--host\x20<host>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20HTTP\x20bind\x20host.\x20Default:\x20127.0.0.1\x0a\x20\x20--port\x20<port>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20HTTP\x20bind\x20port.\x20Default:\x203001\x0a\x20\x20--endpoint\x20<path>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20HTTP\x20MCP\x20endpoint.\x20Default:\x20/mcp\x0a\x20\x20--cors-origin\x20<origin>\x20\x20\x20\x20\x20\x20\x20\x20Allow\x20a\x20browser\x20origin.\x20Repeatable.\x20Use\x20\x22*\x22\x20for\x20development.\x0a\x20\x20--catalog\x20<module>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ESM\x20module\x20exporting\x20the\x20CatalogPromptDescriptor\x20to\x20serve.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Defaults\x20to\x20the\x20A2UI\x20basic\x20catalog.\x0a\x20\x20--schema-delivery\x20<discovery|inline>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Default:\x20discovery\x20(get_ui_catalog\x20+\x20send_ui_to_client).\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Inline\x20exposes\x20only\x20send_ui_to_client,\x20with\x20its\x20full\x20inputSchema.\x0a\x20\x20--protocol-version\x20<v0.9.1>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20A2UI\x20version\x20requested\x20in\x20generated\x20UI.\x20Default:\x20v0.9.1\x0a\x20\x20--name\x20<name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20MCP\x20server\x20name.\x20Default:\x20@agentic-ui-experience/ui-mcp\x0a\x20\x20--version\x20<version>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20MCP\x20server\x20version.\x20Default:\x200.0.0\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help.\x0a\x0aA\x20server\x20serves\x20exactly\x20one\x20catalog,\x20matching\x20A2UI\x27s\x20model\x20where\x20a\x20surface\x27s\x0acatalog\x20is\x20fixed\x20at\x20createSurface\x20time.\x20Combine\x20vocabularies\x20when\x20you\x20define\x20the\x0acatalog,\x20not\x20at\x20runtime.\x0a\x0aA2UI\x20clients\x20must\x20declare\x20clientCapabilities[\x22v0.9\x22].supportedCatalogIds\x20with\x0athis\x20server\x27s\x20exact\x20Catalog\x20ID.\x20Stateful\x20clients\x20send\x20it\x20in\x20initialize\x0acapabilities.a2ui.\x20This\x20HTTP\x20server\x20is\x20stateless,\x20so\x20every\x20send_ui_to_client\x20call\x0amust\x20also\x20carry\x20the\x20declaration\x20in\x20_meta.a2ui.\x0a\x0aCatalog\x20modules\x20may\x20export\x20one\x20of:\x0a\x20\x20export\x20default\x20descriptor\x0a\x20\x20export\x20const\x20catalog\x20=\x20descriptor\x0a','protocolVersion','endpoint','8WUwrXI','transport','host','setHeader','write','connect','325107tRVLGT','/mcp','error','isArray','stdio','SIGTERM','string','schemaDelivery','name','http://','once','29570670yKmUrK','Unsupported\x20protocol\x20version\x20\x22','message','\x22.\x20Expected\x20\x22discovery\x22\x20or\x20\x22inline\x22.','url','length','4BfRKuO','statusCode','href','http','SIGINT','Mcp-Session-Id','Access-Control-Allow-Methods','method','cors-origin','917275LunIDV','catch','@agentic-ui-experience/ui-mcp\x20listening\x20on\x20http://','serverVersion','Unsupported\x20schema\x20delivery\x20\x22','Catalog\x20module\x20\x22','2594006fvbJZV','pathname','isInteger','includes','30FIWxiU','end','close','map','211138FCayxf','headersSent','inline','join','default','\x22\x20did\x20not\x20export\x20a\x20catalog\x20descriptor.','headers','3600945BNeYRA','version','values','exit','Invalid\x20--port\x20\x22','catalog','9173780xumrUu','catalogs'];_0x109b=function(){return _0x461cf5;};return _0x109b();}const _0x59a8f5=_0x27cc;(function(_0x2510df,_0x5551ad){const _0x46ea4e=_0x27cc,_0x5a383d=_0x2510df();while(!![]){try{const _0x45cdf7=parseInt(_0x46ea4e(0x143))/0x1+-parseInt(_0x46ea4e(0x13b))/0x2+-parseInt(_0x46ea4e(0x14a))/0x3*(-parseInt(_0x46ea4e(0x16f))/0x4)+parseInt(_0x46ea4e(0x135))/0x5*(-parseInt(_0x46ea4e(0x13f))/0x6)+-parseInt(_0x46ea4e(0x150))/0x7+-parseInt(_0x46ea4e(0x158))/0x8*(parseInt(_0x46ea4e(0x15e))/0x9)+parseInt(_0x46ea4e(0x169))/0xa;if(_0x45cdf7===_0x5551ad)break;else _0x5a383d['push'](_0x5a383d['shift']());}catch(_0x2900bd){_0x5a383d['push'](_0x5a383d['shift']());}}}(_0x109b,0xc529b));import{createServer}from'node:http';import{resolve}from'node:path';import{pathToFileURL}from'node:url';import{parseArgs}from'node:util';import{A2UI_SUPPORTED_PROTOCOL_VERSIONS}from'@agentic-ui-experience/ui-core';import{StreamableHTTPServerTransport}from'@modelcontextprotocol/sdk/server/streamableHttp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{createUIMCPServer}from'./index.js';const helpText=_0x59a8f5(0x155);function stringValue(_0x54e53e,_0x5b66be){const _0x14e265=_0x59a8f5;return typeof _0x54e53e===_0x14e265(0x164)&&_0x54e53e[_0x14e265(0x16e)]>0x0?_0x54e53e:_0x5b66be;}function optionalStringValue(_0xd83407){const _0x38b427=_0x59a8f5;return typeof _0xd83407===_0x38b427(0x164)&&_0xd83407['length']>0x0?_0xd83407:void 0x0;}function stringArrayValue(_0x47d9c2){const _0x3d683a=_0x59a8f5;if(Array[_0x3d683a(0x161)](_0x47d9c2))return _0x47d9c2;if(typeof _0x47d9c2===_0x3d683a(0x164)&&_0x47d9c2['length']>0x0)return[_0x47d9c2];return[];}function parseTransport(_0x5e5e11){const _0xf20900=_0x59a8f5;if(_0x5e5e11==='stdio'||_0x5e5e11===_0xf20900(0x172))return _0x5e5e11;throw new Error('Unsupported\x20transport\x20\x22'+_0x5e5e11+'\x22.\x20Expected\x20\x22stdio\x22\x20or\x20\x22http\x22.');}function parseSchemaDelivery(_0x5ac268){const _0x4e35f0=_0x59a8f5;if(_0x5ac268==='discovery'||_0x5ac268===_0x4e35f0(0x145))return _0x5ac268;throw new Error(_0x4e35f0(0x139)+_0x5ac268+_0x4e35f0(0x16c));}function parseProtocolVersion(_0x1a5106){const _0x256b91=_0x59a8f5;if(A2UI_SUPPORTED_PROTOCOL_VERSIONS['some'](_0xae881e=>_0xae881e===_0x1a5106))return _0x1a5106;throw new Error(_0x256b91(0x16a)+_0x1a5106+'\x22.\x20Expected\x20'+A2UI_SUPPORTED_PROTOCOL_VERSIONS[_0x256b91(0x142)](_0x5a5db9=>'\x22'+_0x5a5db9+'\x22')[_0x256b91(0x146)]('\x20or\x20')+'.');}function parsePort(_0x20fb30){const _0x311520=_0x59a8f5,_0x539c83=Number(_0x20fb30);if(!Number[_0x311520(0x13d)](_0x539c83)||_0x539c83<0x1||_0x539c83>0xffff)throw new Error(_0x311520(0x14e)+_0x20fb30+'\x22.\x20Expected\x20an\x20integer\x20from\x201\x20to\x2065535.');return _0x539c83;}function _0x27cc(_0x2d6deb,_0x444ad8){_0x2d6deb=_0x2d6deb-0x134;const _0x109b6b=_0x109b();let _0x27cc96=_0x109b6b[_0x2d6deb];return _0x27cc96;}function normalizeEndpoint(_0x1b9550){if(!_0x1b9550['startsWith']('/'))return'/'+_0x1b9550;return _0x1b9550;}function isCatalogDescriptor(_0x244618){const _0x2e9ffd=_0x59a8f5;return!!_0x244618&&typeof _0x244618==='object'&&!Array[_0x2e9ffd(0x161)](_0x244618)&&typeof _0x244618['id']==='string'&&Array['isArray'](_0x244618['baseComponentNames']);}function readCatalogExport(_0x1e0ab3,_0x2fb181){const _0x8292b6=_0x59a8f5,_0x3e2709=_0x1e0ab3[_0x8292b6(0x151)]??_0x1e0ab3[_0x8292b6(0x14f)]??_0x1e0ab3[_0x8292b6(0x147)];if(Array[_0x8292b6(0x161)](_0x3e2709)){if(_0x3e2709[_0x8292b6(0x16e)]!==0x1)throw new Error('Catalog\x20module\x20\x22'+_0x2fb181+'\x22\x20exported\x20'+_0x3e2709['length']+'\x20catalogs.\x20A\x20server\x20serves\x20exactly\x20one;\x20merge\x20them\x20into\x20a\x20single\x20descriptor.');const [_0x4f2dba]=_0x3e2709;if(!isCatalogDescriptor(_0x4f2dba))throw new Error(_0x8292b6(0x13a)+_0x2fb181+'\x22\x20exported\x20an\x20invalid\x20catalog\x20descriptor.');return _0x4f2dba;}if(_0x3e2709===void 0x0)throw new Error(_0x8292b6(0x13a)+_0x2fb181+_0x8292b6(0x148));if(!isCatalogDescriptor(_0x3e2709))throw new Error('Catalog\x20module\x20\x22'+_0x2fb181+'\x22\x20exported\x20an\x20invalid\x20catalog\x20descriptor.');return _0x3e2709;}async function loadCatalog(_0x3a1e9f){const _0x15dbc3=_0x59a8f5;if(_0x3a1e9f===void 0x0)return void 0x0;const _0x1c98ba=await import(pathToFileURL(resolve(_0x3a1e9f))[_0x15dbc3(0x171)]);return readCatalogExport(_0x1c98ba,_0x3a1e9f);}async function parseCliOptions(){const _0x1328b7=_0x59a8f5,_0x119f57=parseArgs({'allowPositionals':![],'options':{'transport':{'type':'string'},'host':{'type':'string'},'port':{'type':'string'},'endpoint':{'type':_0x1328b7(0x164)},'cors-origin':{'type':'string','multiple':!![]},'catalog':{'type':'string'},'schema-delivery':{'type':_0x1328b7(0x164)},'protocol-version':{'type':'string'},'name':{'type':_0x1328b7(0x164)},'version':{'type':_0x1328b7(0x164)},'help':{'type':'boolean','short':'h'}}});_0x119f57[_0x1328b7(0x14c)]['help']&&(process['stdout'][_0x1328b7(0x15c)](helpText),process[_0x1328b7(0x14d)](0x0));const _0xc6cb62=parseSchemaDelivery(_0x119f57['values']['schema-delivery']??'discovery'),_0x2dd175=await loadCatalog(optionalStringValue(_0x119f57['values'][_0x1328b7(0x14f)])),_0xb3f5f8=optionalStringValue(_0x119f57['values']['protocol-version']);return{'transport':parseTransport(stringValue(_0x119f57['values']['transport'],_0x1328b7(0x162))),'host':stringValue(_0x119f57[_0x1328b7(0x14c)][_0x1328b7(0x15a)],'127.0.0.1'),'port':parsePort(stringValue(_0x119f57['values']['port'],'3001')),'endpoint':normalizeEndpoint(stringValue(_0x119f57['values'][_0x1328b7(0x157)],_0x1328b7(0x15f))),'corsOrigins':stringArrayValue(_0x119f57[_0x1328b7(0x14c)][_0x1328b7(0x134)]),..._0x2dd175?{'catalog':_0x2dd175}:{},'schemaDelivery':_0xc6cb62,..._0xb3f5f8?{'protocolVersion':parseProtocolVersion(_0xb3f5f8)}:{},...optionalStringValue(_0x119f57[_0x1328b7(0x14c)][_0x1328b7(0x166)])?{'serverName':optionalStringValue(_0x119f57[_0x1328b7(0x14c)][_0x1328b7(0x166)])}:{},...optionalStringValue(_0x119f57[_0x1328b7(0x14c)][_0x1328b7(0x14b)])?{'serverVersion':optionalStringValue(_0x119f57[_0x1328b7(0x14c)][_0x1328b7(0x14b)])}:{}};}function createServerOptions(_0x540165){const _0xe02416=_0x59a8f5;return{..._0x540165['catalog']?{'catalog':_0x540165['catalog']}:{},'schemaDelivery':_0x540165[_0xe02416(0x165)],..._0x540165[_0xe02416(0x156)]?{'protocolVersion':_0x540165['protocolVersion']}:{},'server':{..._0x540165['serverName']?{'name':_0x540165['serverName']}:{},..._0x540165[_0xe02416(0x138)]?{'version':_0x540165['serverVersion']}:{}}};}function setCorsHeaders(_0x4e23ae,_0x57233a,_0x560add){const _0x79f9b6=_0x59a8f5;if(_0x560add['length']===0x0)return;const _0x1c20b3=_0x4e23ae[_0x79f9b6(0x149)]['origin'],_0x5af570=_0x560add[_0x79f9b6(0x13e)]('*'),_0x18ca0c=_0x5af570?'*':typeof _0x1c20b3===_0x79f9b6(0x164)&&_0x560add['includes'](_0x1c20b3)?_0x1c20b3:void 0x0;if(!_0x18ca0c)return;_0x57233a[_0x79f9b6(0x15b)]('Access-Control-Allow-Origin',_0x18ca0c),_0x57233a[_0x79f9b6(0x15b)](_0x79f9b6(0x154),'Origin'),_0x57233a['setHeader'](_0x79f9b6(0x175),'GET,POST,DELETE,OPTIONS'),_0x57233a['setHeader']('Access-Control-Allow-Headers','Content-Type,\x20Accept,\x20Authorization,\x20MCP-Protocol-Version,\x20Mcp-Session-Id,\x20Last-Event-ID'),_0x57233a[_0x79f9b6(0x15b)]('Access-Control-Expose-Headers',_0x79f9b6(0x174));}function writeJsonRpcError(_0x1073dd,_0x39bab8,_0x549e86){const _0xeda998=_0x59a8f5;_0x1073dd[_0xeda998(0x170)]=_0x39bab8,_0x1073dd['setHeader']('content-type','application/json'),_0x1073dd[_0xeda998(0x140)](JSON['stringify']({'jsonrpc':_0xeda998(0x152),'error':{'code':-0x7f5b,'message':_0x549e86},'id':null}));}async function startStdio(_0x408391){const _0x38b8eb=_0x59a8f5,_0x74d4c1=createUIMCPServer(createServerOptions(_0x408391));await _0x74d4c1[_0x38b8eb(0x15d)](new StdioServerTransport());}async function startHttp(_0x3ff71a){const _0x577fc2=_0x59a8f5,_0x2bca01=createServer(async(_0x4ee13b,_0x317771)=>{const _0x35f1d1=_0x27cc,_0xd11dc6=new URL(_0x4ee13b[_0x35f1d1(0x16d)]??'/',_0x35f1d1(0x167)+(_0x4ee13b['headers'][_0x35f1d1(0x15a)]??'localhost'));if(_0xd11dc6[_0x35f1d1(0x13c)]!==_0x3ff71a[_0x35f1d1(0x157)]){_0x317771['statusCode']=0x194,_0x317771['end']('Not\x20Found');return;}setCorsHeaders(_0x4ee13b,_0x317771,_0x3ff71a['corsOrigins']);if(_0x4ee13b[_0x35f1d1(0x176)]===_0x35f1d1(0x153)){_0x317771[_0x35f1d1(0x170)]=0xcc,_0x317771[_0x35f1d1(0x140)]();return;}try{const _0x340790=createUIMCPServer(createServerOptions(_0x3ff71a)),_0x4c7f7a=new StreamableHTTPServerTransport({'sessionIdGenerator':void 0x0});await _0x340790['connect'](_0x4c7f7a),await _0x4c7f7a['handleRequest'](_0x4ee13b,_0x317771),_0x317771['on'](_0x35f1d1(0x141),()=>{void _0x4c7f7a['close'](),void _0x340790['close']();});}catch(_0x5efc00){console['error']('[@agentic-ui-experience/ui-mcp]\x20request\x20failed',_0x5efc00),!_0x317771[_0x35f1d1(0x144)]&&writeJsonRpcError(_0x317771,0x1f4,_0x5efc00 instanceof Error?_0x5efc00[_0x35f1d1(0x16b)]:'Internal\x20MCP\x20server\x20error');}});await new Promise((_0x3c26e6,_0x49b7aa)=>{const _0x5c1437=_0x27cc;_0x2bca01['once'](_0x5c1437(0x160),_0x49b7aa),_0x2bca01['listen'](_0x3ff71a['port'],_0x3ff71a[_0x5c1437(0x15a)],_0x3c26e6);});const _0x41a428=()=>{const _0x453103=_0x27cc;_0x2bca01[_0x453103(0x141)](()=>process['exit'](0x0));};process[_0x577fc2(0x168)](_0x577fc2(0x173),_0x41a428),process['once'](_0x577fc2(0x163),_0x41a428),process['stderr']['write'](_0x577fc2(0x137)+_0x3ff71a[_0x577fc2(0x15a)]+':'+_0x3ff71a['port']+_0x3ff71a['endpoint']+'\x0a');}async function main(){const _0x296dd4=_0x59a8f5,_0x147f10=await parseCliOptions();if(_0x147f10[_0x296dd4(0x159)]==='stdio'){await startStdio(_0x147f10);return;}await startHttp(_0x147f10);}main()[_0x59a8f5(0x136)](_0x1199b2=>{const _0x3f5540=_0x59a8f5;process['stderr'][_0x3f5540(0x15c)]((_0x1199b2 instanceof Error?_0x1199b2[_0x3f5540(0x16b)]:String(_0x1199b2))+'\x0a'),process['exit'](0x1);});
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x59efd1,_0x429841){const _0x4ced66=_0x47b9,_0x1a9fdc=_0x59efd1();while(!![]){try{const _0xe225a2=-parseInt(_0x4ced66(0x1a9))/0x1*(parseInt(_0x4ced66(0x1b5))/0x2)+-parseInt(_0x4ced66(0x1af))/0x3+-parseInt(_0x4ced66(0x1ae))/0x4+parseInt(_0x4ced66(0x1aa))/0x5+parseInt(_0x4ced66(0x1b4))/0x6*(-parseInt(_0x4ced66(0x1ab))/0x7)+-parseInt(_0x4ced66(0x1ad))/0x8+parseInt(_0x4ced66(0x1b3))/0x9;if(_0xe225a2===_0x429841)break;else _0x1a9fdc['push'](_0x1a9fdc['shift']());}catch(_0x2e6bf9){_0x1a9fdc['push'](_0x1a9fdc['shift']());}}}(_0x4676,0xce9a5));function _0x4676(){const _0x49e592=['2381230RRDvNl','10654WrfAVX','isArray','2020576JqayMO','3742452CvjvmJ','873870EFoTKU','MCP\x20tool\x20result\x20contains\x20multiple\x20A2UI\x20embedded\x20resources.','A2UI\x20embedded\x20resource\x20is\x20malformed.','content','34341750HAxImL','6144DpAAEo','4BHoxSH','mimeType','filter','uri','MCP\x20tool\x20reported\x20an\x20error.','protocol','text','resource','A2UI\x20embedded\x20resource\x20text\x20must\x20contain\x20valid\x20JSON.','string','length','203874EFTGWF'];_0x4676=function(){return _0x49e592;};return _0x4676();}function _0x47b9(_0x38989f,_0x36091b){_0x38989f=_0x38989f-0x19f;const _0x4676b7=_0x4676();let _0x47b91f=_0x4676b7[_0x38989f];return _0x47b91f;}import{A2UI_MESSAGE_MEDIA_TYPE}from'@agentic-ui-experience/ui-core';import{createUISendNormalizer}from'@agentic-ui-experience/ui-core/tool-mode';const A2UI_MCP_CAPABILITY_FAMILY='v0.9',A2UI_MCP_CAPABILITY_EXTENSION_ID='a2ui/client-capabilities';function isJsonObject(_0xfbeef7){const _0x4a9f8d=_0x47b9;return typeof _0xfbeef7==='object'&&_0xfbeef7!==null&&!Array[_0x4a9f8d(0x1ac)](_0xfbeef7);}function textErrorMessage(_0x5b8ecc){const _0x208795=_0x47b9;if(!Array[_0x208795(0x1ac)](_0x5b8ecc[_0x208795(0x1b2)]))return'MCP\x20tool\x20reported\x20an\x20error.';const _0x18c818=_0x5b8ecc[_0x208795(0x1b2)][_0x208795(0x1a0)](isJsonObject)[_0x208795(0x1a0)](_0x143d58=>_0x143d58['type']===_0x208795(0x1a4)&&typeof _0x143d58[_0x208795(0x1a4)]==='string')['map'](_0x3b70e6=>_0x3b70e6[_0x208795(0x1a4)])[_0x208795(0x1a0)](_0x5a7c87=>_0x5a7c87[_0x208795(0x1a8)]>0x0);return _0x18c818['join']('\x0a')||_0x208795(0x1a2);}function isAbsoluteUri(_0x7e411b){const _0x1b092f=_0x47b9;try{return new URL(_0x7e411b)[_0x1b092f(0x1a3)][_0x1b092f(0x1a8)]>0x1;}catch{return![];}}function createA2UIClientCapabilities(_0x301437){const _0x322218=_0x47b9;if(!Array[_0x322218(0x1ac)](_0x301437)||_0x301437[_0x322218(0x1a8)]===0x0)throw new Error('A2UI\x20client\x20capabilities\x20require\x20at\x20least\x20one\x20Catalog\x20ID.');const _0x58fcd0=[];for(const _0x24a705 of _0x301437){if(typeof _0x24a705!=='string'||_0x24a705['trim']()['length']===0x0)throw new Error('A2UI\x20client\x20capability\x20Catalog\x20IDs\x20must\x20be\x20non-empty\x20strings.');if(!_0x58fcd0['includes'](_0x24a705))_0x58fcd0['push'](_0x24a705);}const _0x3de54e={'clientCapabilities':{[A2UI_MCP_CAPABILITY_FAMILY]:{'supportedCatalogIds':_0x58fcd0}}};return{'a2ui':_0x3de54e,'extensions':{[A2UI_MCP_CAPABILITY_EXTENSION_ID]:_0x3de54e}};}function extractUIMCPToolResult(_0x34d908,_0x50a41e={}){const _0x3b50a7=_0x47b9;if(!isJsonObject(_0x34d908))return void 0x0;if(_0x34d908['isError']===!![])throw new Error(textErrorMessage(_0x34d908));if(!Array[_0x3b50a7(0x1ac)](_0x34d908['content']))return void 0x0;const _0x7392b6=_0x34d908['content'][_0x3b50a7(0x1a0)](_0x53ad9d=>{const _0x511c82=_0x3b50a7;if(!isJsonObject(_0x53ad9d)||_0x53ad9d['type']!=='resource')return![];if(!isJsonObject(_0x53ad9d['resource']))return![];return _0x53ad9d['resource'][_0x511c82(0x19f)]===A2UI_MESSAGE_MEDIA_TYPE;});if(_0x7392b6[_0x3b50a7(0x1a8)]===0x0)return void 0x0;if(_0x7392b6['length']>0x1)throw new Error(_0x3b50a7(0x1b0));const _0x2dd13a=_0x7392b6[0x0][_0x3b50a7(0x1a5)];if(!isJsonObject(_0x2dd13a))throw new Error(_0x3b50a7(0x1b1));if(typeof _0x2dd13a[_0x3b50a7(0x1a1)]!==_0x3b50a7(0x1a7)||!isAbsoluteUri(_0x2dd13a['uri']))throw new Error('A2UI\x20embedded\x20resource\x20must\x20contain\x20a\x20valid\x20absolute\x20URI.');if(typeof _0x2dd13a[_0x3b50a7(0x1a4)]!=='string')throw new Error('A2UI\x20embedded\x20resource\x20must\x20contain\x20text\x20content.');let _0xa865af;try{_0xa865af=JSON['parse'](_0x2dd13a['text']);}catch{throw new Error(_0x3b50a7(0x1a6));}const _0x97521c=createUISendNormalizer({'mode':'strict','catalog':_0x50a41e['catalog']})({'messages':_0xa865af});return{..._0x97521c,'resourceUri':_0x2dd13a['uri'],'mimeType':A2UI_MESSAGE_MEDIA_TYPE};}export{A2UI_MCP_CAPABILITY_EXTENSION_ID,A2UI_MCP_CAPABILITY_FAMILY,createA2UIClientCapabilities,extractUIMCPToolResult};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x2b5726=_0x2831;(function(_0x15e93b,_0x29aaeb){const _0x1d429e=_0x2831,_0x41a6ee=_0x15e93b();while(!![]){try{const _0x411598=-parseInt(_0x1d429e(0x83))/0x1+-parseInt(_0x1d429e(0xa0))/0x2+-parseInt(_0x1d429e(0xad))/0x3*(-parseInt(_0x1d429e(0x71))/0x4)+parseInt(_0x1d429e(0x91))/0x5*(-parseInt(_0x1d429e(0x93))/0x6)+parseInt(_0x1d429e(0x92))/0x7+-parseInt(_0x1d429e(0x8e))/0x8*(-parseInt(_0x1d429e(0x99))/0x9)+parseInt(_0x1d429e(0x80))/0xa;if(_0x411598===_0x29aaeb)break;else _0x41a6ee['push'](_0x41a6ee['shift']());}catch(_0x328bd4){_0x41a6ee['push'](_0x41a6ee['shift']());}}}(_0x3d32,0xb67e3));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{McpServer as _0x35f72c}from'@modelcontextprotocol/sdk/server/mcp.js';import{z}from'zod';import{A2UI_SUPPORTED_PROTOCOL_VERSIONS,A2UI_DEFAULT_PROTOCOL_VERSION,A2UI_MESSAGE_MEDIA_TYPE}from'@agentic-ui-experience/ui-core';import{createUISendNormalizer,createUIToolCatalog,CATALOG_RESOURCE_URI,createUICatalogResourcePayload,GET_UI_CATALOG_TOOL_NAME,UI_TOOL_NAME,UI_TOOL_WORKFLOW_ORDER,getUICatalog,createUISendToolSpec,UI_TOOL_WORKFLOW}from'@agentic-ui-experience/ui-core/tool-mode';function _0x3d32(){const _0x172227=['lazy','number','set','directory','normalize','registerResource','unknown','string','array','optional','discovery','componentNames','The\x20complete\x20A2UI\x20','20578660jasrOi','title','enum','1193434wrqvlb','every','@agentic-ui-experience/ui-mcp','getPrototypeOf','Unsupported\x20schemaDelivery\x20\x22','stringify','inline','catalog','delete','href','prototype','16VPyFdF','length','-\x20The\x20first\x20message\x20must\x20be\x20createSurface.','1185VjHaUq','7667058qWDwDZ','36000pmqiZB','Client\x20A2UI\x20capabilities\x20are\x20malformed:\x20clientCapabilities[\x22','describe','Use\x20this\x20only\x20as\x20workflow\x20step\x202,\x20after\x20fetching\x20component\x20schemas\x20with\x20','registerTool','functionNames','3723633SbhWkM','annotations','\x20at\x20`createSurface.catalogId`.','join','object','literal','Build\x20component\x20objects\x20from\x20the\x20schema\x20returned\x20by\x20','2888002kuqhjm','union','Generated\x20an\x20interactive\x20A2UI\x20interface.','\x22\x20(','supportedCatalogIds','isFinite','message','\x20in\x20the\x20same\x20task.\x20This\x20tool\x20validates\x20and\x20returns\x20A2UI\x20messages;\x20it\x20is\x20not\x20the\x20source\x20of\x20component\x20schemas.','a2ui-catalog','add','-\x20createSurface.catalogId\x20must\x20be\x20\x22','discriminatedUnion','With\x20componentNames\x20it\x20returns\x20only\x20the\x20selected\x20generation\x20contract:\x20A2UI\x20guidance\x20in\x20catalog.instructions\x20and\x20machine-readable\x20component/function\x20definitions\x20in\x20catalog.definitions.\x20The\x20directory\x20is\x20omitted\x20from\x20this\x20selected\x20response.','6HYLjPw','record','Catalog\x20id:\x20','keys','get','isArray','catchall','uiJson','Get\x20A2UI\x20Catalog','uiMessages','has','A2UI\x20catalog\x20instructions\x20and\x20component\x20schema.','kind','ownKeys','-\x20Later\x20updateComponents/updateDataModel/deleteSurface\x20messages\x20must\x20target\x20the\x20same\x20surface.','text','strict','descriptor','a2ui','surfaceId','mode','1652584RbhCaF','Do\x20not\x20call\x20this\x20tool\x20before\x20'];_0x3d32=function(){return _0x172227;};return _0x3d32();}import{A2UI_MCP_CAPABILITY_FAMILY,A2UI_MCP_CAPABILITY_EXTENSION_ID}from'./client.js';const jsonValueSchema=z[_0x2b5726(0x73)](()=>z[_0x2b5726(0xa1)]([z['null'](),z['boolean'](),z['number'](),z['string'](),z['array'](jsonValueSchema),z[_0x2b5726(0xae)](z[_0x2b5726(0x7a)](),jsonValueSchema)])),jsonObjectSchema=z['record'](z[_0x2b5726(0x7a)](),jsonValueSchema),catalogDescriptionBaseSchema={'id':z['string'](),'resourceUri':z[_0x2b5726(0x7a)](),'instructions':z[_0x2b5726(0x7a)]()},catalogBasicDefinitionsSchema=z['object']({'format':z['literal']('json-schema'),'schema':jsonObjectSchema}),catalogDefinitionsSchema=z[_0x2b5726(0x9d)]({'componentNames':z[_0x2b5726(0x7b)](z['string']()),'functionNames':z[_0x2b5726(0x7b)](z[_0x2b5726(0x7a)]()),'basicComponents':catalogBasicDefinitionsSchema[_0x2b5726(0x7c)](),'customComponents':z[_0x2b5726(0xae)](z[_0x2b5726(0x7a)](),z['union']([z['boolean'](),jsonObjectSchema])),'functions':z[_0x2b5726(0xae)](z['string'](),jsonObjectSchema),'$defs':jsonObjectSchema}),getCatalogOutputSchema={'catalog':z[_0x2b5726(0xab)](_0x2b5726(0xb9),[z[_0x2b5726(0x9d)]({...catalogDescriptionBaseSchema,'kind':z[_0x2b5726(0x9e)](_0x2b5726(0x76)),'componentPurposes':z[_0x2b5726(0xae)](z[_0x2b5726(0x7a)](),z[_0x2b5726(0x7a)]()),'definitions':catalogDefinitionsSchema['optional']()}),z[_0x2b5726(0x9d)]({...catalogDescriptionBaseSchema,'kind':z['literal']('selection'),'definitions':catalogDefinitionsSchema})])},protocolVersionSchema=z[_0x2b5726(0x82)](A2UI_SUPPORTED_PROTOCOL_VERSIONS),componentSchema=jsonObjectSchema,createSurfaceMessageSchema=z[_0x2b5726(0x9d)]({'version':protocolVersionSchema,'createSurface':z['object']({'surfaceId':z['string'](),'catalogId':z[_0x2b5726(0x7a)]()})[_0x2b5726(0xb3)](jsonValueSchema)})['catchall'](jsonValueSchema),updateComponentsMessageSchema=z['object']({'version':protocolVersionSchema,'updateComponents':z[_0x2b5726(0x9d)]({'surfaceId':z[_0x2b5726(0x7a)](),'components':z['array'](componentSchema)})[_0x2b5726(0xb3)](jsonValueSchema)})[_0x2b5726(0xb3)](jsonValueSchema),updateDataModelMessageSchema=z['object']({'version':protocolVersionSchema,'updateDataModel':z['object']({'surfaceId':z[_0x2b5726(0x7a)](),'path':z['string']()['optional'](),'value':jsonValueSchema['optional']()})['catchall'](jsonValueSchema)})[_0x2b5726(0xb3)](jsonValueSchema),deleteSurfaceMessageSchema=z['object']({'version':protocolVersionSchema,'deleteSurface':z['object']({'surfaceId':z[_0x2b5726(0x7a)]()})['catchall'](jsonValueSchema)})['catchall'](jsonValueSchema);function createSendUIInputSchema(_0x62de57=A2UI_DEFAULT_PROTOCOL_VERSION){const _0x7edb8e=_0x2b5726;return{'surfaceId':z['string']()['optional']()[_0x7edb8e(0x95)]('Optional\x20expected\x20surface\x20id\x20for\x20this\x20UI\x20call.\x20When\x20supplied,\x20`messages[0].createSurface.surfaceId`\x20must\x20match\x20it.'),'messages':z[_0x7edb8e(0x7b)](z[_0x7edb8e(0xa1)]([createSurfaceMessageSchema,updateComponentsMessageSchema,updateDataModelMessageSchema,deleteSurfaceMessageSchema]))['describe']([_0x7edb8e(0x7f)+_0x62de57+'\x20UI\x20message\x20array.','Every\x20message\x20you\x20generate\x20must\x20use\x20\x22version\x22:\x20\x22'+_0x62de57+'\x22;\x20no\x20other\x20wire\x20version\x20is\x20accepted.',_0x7edb8e(0x96)+GET_UI_CATALOG_TOOL_NAME+'.',_0x7edb8e(0x9f)+GET_UI_CATALOG_TOOL_NAME+';\x20do\x20not\x20guess\x20component\x20fields\x20from\x20this\x20tool\x20schema.','Do\x20not\x20pass\x20a\x20JSON\x20string\x20and\x20do\x20not\x20use\x20a\x20ui_json\x20field.','Every\x20entry\x20contains\x20`version`\x20and\x20exactly\x20one\x20of\x20`createSurface`/`updateComponents`/`updateDataModel`/`deleteSurface`.','The\x20first\x20entry\x20must\x20be\x20`createSurface`,\x20carrying\x20the\x20catalog\x20id\x20reported\x20by\x20'+GET_UI_CATALOG_TOOL_NAME+_0x7edb8e(0x9b),'Component\x20objects\x20belong\x20inside\x20a\x20later\x20`updateComponents.components`\x20array.'][_0x7edb8e(0x9c)]('\x20'))};}function createGetCatalogInputSchema(){const _0x3b9d6d=_0x2b5726;return{'componentNames':z['array'](z['string']())['min'](0x1)['optional']()['describe']('Component\x20names\x20whose\x20field\x20rules\x20and\x20schemas\x20you\x20need.\x20Omit\x20on\x20the\x20first\x20call\x20to\x20get\x20the\x20catalog\x20directory\x20—\x20every\x20component\x20name\x20with\x20one\x20line\x20on\x20what\x20it\x20is\x20for\x20—\x20then\x20call\x20again\x20with\x20the\x20components\x20this\x20UI\x20actually\x20uses.'),'functionNames':z['array'](z[_0x3b9d6d(0x7a)]())['min'](0x1)['optional']()[_0x3b9d6d(0x95)]('Optional\x20catalog\x20function\x20names\x20whose\x20full\x20schemas\x20you\x20need\x20(e.g.\x20formatDate,\x20formatNumber).\x20The\x20directory\x20instructions\x20list\x20available\x20functions\x20by\x20name\x20and\x20arguments;\x20requested\x20schemas\x20are\x20returned\x20in\x20catalog.definitions.functions.\x20Omit\x20when\x20the\x20UI\x20calls\x20no\x20functions.')};}function createGenericToolDescription(_0x10bf0b){const _0x1352e6=_0x2b5726,_0x3e1116=_0x10bf0b['protocolVersion']??A2UI_DEFAULT_PROTOCOL_VERSION;return['Final\x20step:\x20render\x20UI\x20on\x20the\x20client\x20by\x20submitting\x20structured\x20A2UI\x20messages.',UI_TOOL_WORKFLOW,_0x1352e6(0x72)+GET_UI_CATALOG_TOOL_NAME+_0x1352e6(0xa7),_0x1352e6(0xaf)+_0x10bf0b['descriptor']['id']+'.','Message\x20list\x20rules:','-\x20Every\x20message\x20you\x20generate\x20must\x20include\x20\x22version\x22:\x20\x22'+_0x3e1116+'\x22.',_0x1352e6(0x90),'-\x20createSurface.surfaceId\x20must\x20match\x20the\x20top-level\x20surfaceId\x20when\x20supplied.',_0x1352e6(0xaa)+_0x10bf0b['descriptor']['id']+'\x22.',_0x1352e6(0xbb),'-\x20Component\x20objects\x20belong\x20only\x20inside\x20updateComponents.components\x20and\x20must\x20conform\x20to\x20the\x20schemas\x20returned\x20by\x20get_ui_catalog.','Do\x20not\x20send\x20`ui_json`;\x20do\x20not\x20serialize\x20the\x20messages\x20into\x20a\x20JSON\x20string.'][_0x1352e6(0x9c)]('\x0a\x0a');}function createUIMCPNormalize(_0x25a61a={}){const _0x415197=_0x2b5726;return createUISendNormalizer({'mode':_0x25a61a[_0x415197(0x70)],'surfaceId':_0x25a61a['surfaceId'],'catalog':_0x25a61a[_0x415197(0x8a)]});}const defaultNormalize=createUIMCPNormalize(),carrierValidators=new WeakMap();function getCarrierValidator(_0x3750cb){const _0x52a231=_0x2b5726;if(_0x3750cb===void 0x0)return defaultNormalize;const _0x535d1b=carrierValidators[_0x52a231(0xb1)](_0x3750cb);if(_0x535d1b)return _0x535d1b;const _0x5a6295=createUIMCPNormalize({'mode':_0x52a231(0xbd),'catalog':_0x3750cb});return carrierValidators[_0x52a231(0x75)](_0x3750cb,_0x5a6295),_0x5a6295;}function isJsonObject(_0x436b96){const _0x386c74=_0x2b5726;return typeof _0x436b96===_0x386c74(0x9d)&&_0x436b96!==null&&!Array['isArray'](_0x436b96);}function isPlainJsonObject(_0x4718a5){const _0x20e08b=_0x2b5726;if(!isJsonObject(_0x4718a5))return![];const _0xe79168=Object[_0x20e08b(0x86)](_0x4718a5);return _0xe79168===Object['prototype']||_0xe79168===null;}function hasOwn(_0x5927da,_0x302154){const _0x40c86c=_0x2b5726;return Object[_0x40c86c(0x8d)]['hasOwnProperty']['call'](_0x5927da,_0x302154);}function jsonValuesEqual(_0x576185,_0x4bb62b,_0x2a19f2=new WeakSet(),_0x1d7d26=new WeakSet()){const _0x3bc203=_0x2b5726;if(_0x576185===null||_0x4bb62b===null)return _0x576185===_0x4bb62b;if(typeof _0x576185!==typeof _0x4bb62b)return![];if(typeof _0x576185===_0x3bc203(0x7a)||typeof _0x576185==='boolean')return _0x576185===_0x4bb62b;if(typeof _0x576185===_0x3bc203(0x74))return Number[_0x3bc203(0xa5)](_0x576185)&&Number['isFinite'](_0x4bb62b)&&_0x576185===_0x4bb62b;if(typeof _0x576185!==_0x3bc203(0x9d)||typeof _0x4bb62b!==_0x3bc203(0x9d))return![];if(_0x2a19f2[_0x3bc203(0xb7)](_0x576185)||_0x1d7d26[_0x3bc203(0xb7)](_0x4bb62b))return![];_0x2a19f2['add'](_0x576185),_0x1d7d26[_0x3bc203(0xa9)](_0x4bb62b);try{if(Array[_0x3bc203(0xb2)](_0x576185)||Array[_0x3bc203(0xb2)](_0x4bb62b)){if(!Array[_0x3bc203(0xb2)](_0x576185)||!Array['isArray'](_0x4bb62b))return![];if(_0x576185['length']!==_0x4bb62b[_0x3bc203(0x8f)])return![];if(Reflect['ownKeys'](_0x576185)[_0x3bc203(0x8f)]!==_0x576185[_0x3bc203(0x8f)]+0x1)return![];if(Reflect['ownKeys'](_0x4bb62b)[_0x3bc203(0x8f)]!==_0x4bb62b[_0x3bc203(0x8f)]+0x1)return![];for(let _0x5a08bd=0x0;_0x5a08bd<_0x576185['length'];_0x5a08bd+=0x1){if(!hasOwn(_0x576185,String(_0x5a08bd)))return![];if(!hasOwn(_0x4bb62b,String(_0x5a08bd)))return![];if(!jsonValuesEqual(_0x576185[_0x5a08bd],_0x4bb62b[_0x5a08bd],_0x2a19f2,_0x1d7d26))return![];}return!![];}if(!isPlainJsonObject(_0x576185)||!isPlainJsonObject(_0x4bb62b))return![];const _0x5adc9b=Object[_0x3bc203(0xb0)](_0x576185),_0x30db77=Object['keys'](_0x4bb62b);if(Reflect[_0x3bc203(0xba)](_0x576185)[_0x3bc203(0x8f)]!==_0x5adc9b[_0x3bc203(0x8f)])return![];if(Reflect[_0x3bc203(0xba)](_0x4bb62b)['length']!==_0x30db77[_0x3bc203(0x8f)])return![];if(_0x5adc9b['length']!==_0x30db77['length'])return![];return _0x5adc9b['every'](_0x39ee6=>hasOwn(_0x4bb62b,_0x39ee6)&&jsonValuesEqual(_0x576185[_0x39ee6],_0x4bb62b[_0x39ee6],_0x2a19f2,_0x1d7d26));}finally{_0x2a19f2[_0x3bc203(0x8b)](_0x576185),_0x1d7d26[_0x3bc203(0x8b)](_0x4bb62b);}}function getNormalizedSurfaceId(_0x460b23,_0x57ad37,_0x47e419){const _0x708937=_0x2b5726;if(typeof _0x460b23['uiJson']!=='string'||!Array[_0x708937(0xb2)](_0x460b23['uiMessages']))throw new Error('UI\x20normalizer\x20must\x20return\x20uiJson\x20and\x20uiMessages.');let _0x107106;try{_0x107106=JSON['parse'](_0x460b23[_0x708937(0xb4)]);}catch{throw new Error('UI\x20normalizer\x20uiJson\x20must\x20contain\x20valid\x20JSON.');}if(!jsonValuesEqual(_0x107106,_0x460b23[_0x708937(0xb6)]))throw new Error('UI\x20normalizer\x20uiJson\x20and\x20uiMessages\x20must\x20represent\x20the\x20same\x20JSON\x20value.');if(!Array['isArray'](_0x107106)||!isJsonObject(_0x107106[0x0]))throw new Error('UI\x20normalizer\x20result\x20must\x20begin\x20with\x20createSurface.');const _0x231b20=_0x107106[0x0]['createSurface'];if(!isJsonObject(_0x231b20)||typeof _0x231b20['surfaceId']!==_0x708937(0x7a))throw new Error('UI\x20normalizer\x20result\x20must\x20begin\x20with\x20createSurface.');return getCarrierValidator(_0x47e419['catalog'])({'messages':_0x107106,..._0x57ad37===void 0x0?{}:{'surfaceId':_0x57ad37}}),_0x231b20['surfaceId'];}function getA2UIClientCapability(_0x92b114,_0x3c5e27){const _0x4f4772=_0x2b5726;if(isJsonObject(_0x3c5e27)&&hasOwn(_0x3c5e27,_0x4f4772(0x6e)))return _0x3c5e27['a2ui'];const _0x3c70dc=_0x92b114['server']['getClientCapabilities']();if(!isJsonObject(_0x3c70dc))return void 0x0;if(hasOwn(_0x3c70dc,_0x4f4772(0x6e)))return _0x3c70dc['a2ui'];const _0x51014e=_0x3c70dc['extensions'];return isJsonObject(_0x51014e)&&hasOwn(_0x51014e,A2UI_MCP_CAPABILITY_EXTENSION_ID)?_0x51014e[A2UI_MCP_CAPABILITY_EXTENSION_ID]:void 0x0;}function validateA2UIClientCapability(_0x293f7a,_0x5e8e44){const _0x44b927=_0x2b5726;if(!isJsonObject(_0x293f7a))return'Client\x20must\x20declare\x20A2UI\x20'+A2UI_MCP_CAPABILITY_FAMILY+'\x20capability-family\x20support\x20for\x20Catalog\x20\x22'+_0x5e8e44+'\x22.';const _0x403e78=_0x293f7a['clientCapabilities'];if(!isJsonObject(_0x403e78))return'Client\x20A2UI\x20capabilities\x20are\x20malformed:\x20clientCapabilities\x20is\x20required.';const _0x330a5f=_0x403e78[A2UI_MCP_CAPABILITY_FAMILY];if(!isJsonObject(_0x330a5f)||!Array['isArray'](_0x330a5f['supportedCatalogIds']))return _0x44b927(0x94)+A2UI_MCP_CAPABILITY_FAMILY+'\x22].supportedCatalogIds\x20must\x20be\x20an\x20array.';if(!_0x330a5f['supportedCatalogIds'][_0x44b927(0x84)](_0x38c2c6=>typeof _0x38c2c6==='string'))return'Client\x20A2UI\x20capabilities\x20are\x20malformed:\x20supportedCatalogIds\x20must\x20contain\x20only\x20strings.';if(!_0x330a5f[_0x44b927(0xa4)]['includes'](_0x5e8e44))return'Client\x20does\x20not\x20support\x20required\x20A2UI\x20Catalog\x20\x22'+_0x5e8e44+_0x44b927(0xa3)+A2UI_MCP_CAPABILITY_FAMILY+'\x20capability\x20family).';return void 0x0;}function toToolError(_0x1e048b){return{'isError':!![],'content':[{'type':'text','text':_0x1e048b}]};}function toToolResult(_0x49b382,_0x5535b3,_0x22bce0){const _0x7c0fab=_0x2b5726,_0x53c1a1=getNormalizedSurfaceId(_0x49b382,_0x5535b3,_0x22bce0),_0x370927={'type':'resource','resource':{'uri':'a2ui://surface/'+encodeURIComponent(_0x53c1a1),'mimeType':A2UI_MESSAGE_MEDIA_TYPE,'text':_0x49b382['uiJson']}};return{'content':[{'type':_0x7c0fab(0xbc),'text':_0x7c0fab(0xa2)},_0x370927]};}function toCatalogToolResult(_0xf91d1b){const _0x1dbded=_0x2b5726;return{'content':[{'type':_0x1dbded(0xbc),'text':JSON[_0x1dbded(0x88)](_0xf91d1b)}],'structuredContent':_0xf91d1b};}async function createUIToolCallResult(_0x1c93a5,_0x2a9805=defaultNormalize,_0x2eaaa2={}){const _0x33d291=_0x2b5726;try{const _0x440d00=_0x1c93a5[_0x33d291(0x6f)],_0x1e3db7=await _0x2a9805(_0x1c93a5);return toToolResult(_0x1e3db7,_0x440d00,_0x2eaaa2);}catch(_0x556309){const _0x5c8b23=_0x556309 instanceof Error?_0x556309['message']:String(_0x556309);return toToolError(_0x5c8b23);}}function toMCPResourceResult(_0x22875b){return _0x22875b;}function registerUICatalogResources(_0x254f66,_0x44a8db){const _0xe4990e=_0x2b5726,_0x2f843c=_0x254f66[_0xe4990e(0x78)](_0xe4990e(0xa8),CATALOG_RESOURCE_URI,{'title':'A2UI\x20Catalog\x20'+_0x44a8db['descriptor']['id'],'description':_0xe4990e(0xb8),'mimeType':'application/json'},_0x464bf2=>toMCPResourceResult(createUICatalogResourcePayload(_0x44a8db,_0x464bf2[_0xe4990e(0x8c)])));return{'catalog':_0x2f843c};}function registerUICatalogTools(_0xc828a,_0x200e67){const _0x561d46=_0x2b5726,_0x54a9cf=_0xc828a['registerTool'](GET_UI_CATALOG_TOOL_NAME,{'title':_0x561d46(0xb5),'description':['Step\x201\x20of\x20the\x20A2UI\x20MCP\x20workflow.\x20Call\x20this\x20before\x20'+UI_TOOL_NAME+'.',UI_TOOL_WORKFLOW_ORDER,'With\x20no\x20componentNames\x20it\x20returns\x20the\x20catalog\x20directory:\x20the\x20catalog\x20id\x20and\x20every\x20component\x20name\x20with\x20one\x20line\x20saying\x20what\x20it\x20is\x20for.\x20Choose\x20all\x20components\x20the\x20UI\x20needs,\x20then\x20call\x20again\x20with\x20those\x20componentNames.',_0x561d46(0xac),'Basic\x20component\x20and\x20requested\x20function\x20definitions\x20are\x20JSON\x20Schemas\x20whose\x20references\x20resolve\x20from\x20the\x20whole\x20catalog.definitions\x20object,\x20including\x20its\x20shared\x20$defs.\x20Custom\x20component\x20schemas\x20retain\x20their\x20own\x20document\x20scope.']['join']('\x0a\x0a'),'inputSchema':createGetCatalogInputSchema(),'outputSchema':getCatalogOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]}},async _0x522544=>{const _0x1ac83a=_0x561d46;try{return toCatalogToolResult(getUICatalog(_0x200e67,{'componentNames':_0x522544[_0x1ac83a(0x7e)],'functionNames':_0x522544[_0x1ac83a(0x98)]}));}catch(_0x1acf0d){const _0x7c2f1=_0x1acf0d instanceof Error?_0x1acf0d[_0x1ac83a(0xa6)]:String(_0x1acf0d);return toToolError(_0x7c2f1);}});return{'get':_0x54a9cf};}function resolveSchemaDelivery(_0xc65fd5='discovery'){const _0x525ee5=_0x2b5726;if(_0xc65fd5==='discovery'||_0xc65fd5===_0x525ee5(0x89))return _0xc65fd5;throw new Error(_0x525ee5(0x87)+String(_0xc65fd5)+'\x22.\x20Expected\x20\x22discovery\x22\x20or\x20\x22inline\x22.');}function registerGenericUITool(_0x334a18,_0x33a169,_0x2bb0bd={}){const _0x3c4b94=_0x2b5726,_0x24d76c=resolveSchemaDelivery(_0x2bb0bd['schemaDelivery']),_0x1cf148=_0x24d76c==='inline'?createUISendToolSpec(_0x33a169):void 0x0,_0x4e029a=_0x2bb0bd[_0x3c4b94(0x77)]??createUISendNormalizer({'catalog':_0x33a169}),_0xe8c95=_0x1cf148?z[_0x3c4b94(0x9d)]({'surfaceId':z['string']()[_0x3c4b94(0x7c)](),'messages':z[_0x3c4b94(0x79)]()})['meta'](_0x1cf148['parameters']):z['object'](createSendUIInputSchema(_0x33a169['protocolVersion']??A2UI_DEFAULT_PROTOCOL_VERSION));return _0x334a18[_0x3c4b94(0x97)](UI_TOOL_NAME,{'title':_0x2bb0bd[_0x3c4b94(0x81)],'description':_0x1cf148?.['description']??createGenericToolDescription(_0x33a169),'inputSchema':_0xe8c95,'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![],..._0x2bb0bd[_0x3c4b94(0x9a)]}},async(_0x16b0ca,_0x1623bf)=>{const _0x370fab=_0x3c4b94,_0x4fb2bc=validateA2UIClientCapability(getA2UIClientCapability(_0x334a18,_0x1623bf['_meta']),_0x33a169[_0x370fab(0xbe)]['id']);if(_0x4fb2bc)return toToolError(_0x4fb2bc);return createUIToolCallResult(_0x16b0ca,_0x4e029a,{'catalog':_0x33a169});});}function _0x2831(_0x352309,_0x4ed600){_0x352309=_0x352309-0x6e;const _0x3d323f=_0x3d32();let _0x2831fc=_0x3d323f[_0x352309];return _0x2831fc;}function createUIMCPServer(_0x197c65={}){const _0x3928a7=_0x2b5726,_0x3de60d=resolveSchemaDelivery(_0x197c65['schemaDelivery']),_0xc2b042=createUIToolCatalog(_0x197c65['catalog'],_0x197c65['protocolVersion']),_0x104d53=new McpServer({'name':_0x197c65['server']?.['name']??_0x3928a7(0x85),'version':_0x197c65['server']?.['version']??'0.0.0'});registerUICatalogResources(_0x104d53,_0xc2b042);if(_0x3de60d===_0x3928a7(0x7d))registerUICatalogTools(_0x104d53,_0xc2b042);return registerGenericUITool(_0x104d53,_0xc2b042,{..._0x197c65,'schemaDelivery':_0x3de60d}),_0x104d53;}export{_0x35f72c as McpServer,createUIMCPNormalize,createUIMCPServer,createUIToolCallResult,registerGenericUITool,registerUICatalogResources,registerUICatalogTools};
|
|
1
|
+
const _0x2d3a0f=_0x3cda;(function(_0x2a984f,_0x575bb8){const _0x508201=_0x3cda,_0xb06535=_0x2a984f();while(!![]){try{const _0x23eff8=parseInt(_0x508201(0x151))/0x1*(parseInt(_0x508201(0x168))/0x2)+parseInt(_0x508201(0x1a6))/0x3+parseInt(_0x508201(0x176))/0x4*(-parseInt(_0x508201(0x169))/0x5)+parseInt(_0x508201(0x175))/0x6+-parseInt(_0x508201(0x163))/0x7*(-parseInt(_0x508201(0x19d))/0x8)+-parseInt(_0x508201(0x19c))/0x9*(-parseInt(_0x508201(0x185))/0xa)+parseInt(_0x508201(0x198))/0xb*(parseInt(_0x508201(0x189))/0xc);if(_0x23eff8===_0x575bb8)break;else _0xb06535['push'](_0xb06535['shift']());}catch(_0x33fa8d){_0xb06535['push'](_0xb06535['shift']());}}}(_0x410d,0xb87b4));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{McpServer as _0xd83c53}from'@modelcontextprotocol/sdk/server/mcp.js';import{z}from'zod';import{A2UI_SUPPORTED_PROTOCOL_VERSIONS,A2UI_DEFAULT_PROTOCOL_VERSION,A2UI_MESSAGE_MEDIA_TYPE}from'@agentic-ui-experience/ui-core';import{createUISendNormalizer,createUIToolCatalog,CATALOG_RESOURCE_URI,createUICatalogResourcePayload,GET_UI_CATALOG_TOOL_NAME,UI_TOOL_NAME,UI_TOOL_WORKFLOW_ORDER,getUICatalog,createUISendToolSpec,UI_TOOL_WORKFLOW}from'@agentic-ui-experience/ui-core/tool-mode';import{A2UI_MCP_CAPABILITY_FAMILY,A2UI_MCP_CAPABILITY_EXTENSION_ID}from'./client.js';const jsonValueSchema=z['lazy'](()=>z['union']([z[_0x2d3a0f(0x17e)](),z['boolean'](),z['number'](),z[_0x2d3a0f(0x186)](),z[_0x2d3a0f(0x14d)](jsonValueSchema),z[_0x2d3a0f(0x15f)](z['string'](),jsonValueSchema)])),jsonObjectSchema=z['record'](z[_0x2d3a0f(0x186)](),jsonValueSchema),catalogDescriptionBaseSchema={'id':z[_0x2d3a0f(0x186)](),'resourceUri':z[_0x2d3a0f(0x186)](),'instructions':z['string']()},catalogBasicDefinitionsSchema=z['object']({'format':z[_0x2d3a0f(0x153)](_0x2d3a0f(0x15b)),'schema':jsonObjectSchema}),catalogDefinitionsSchema=z[_0x2d3a0f(0x14c)]({'componentNames':z[_0x2d3a0f(0x14d)](z['string']()),'functionNames':z[_0x2d3a0f(0x14d)](z['string']()),'basicComponents':catalogBasicDefinitionsSchema['optional'](),'customComponents':z[_0x2d3a0f(0x15f)](z['string'](),z[_0x2d3a0f(0x158)]([z[_0x2d3a0f(0x16b)](),jsonObjectSchema])),'functions':z['record'](z['string'](),jsonObjectSchema),'$defs':jsonObjectSchema}),getCatalogOutputSchema={'catalog':z[_0x2d3a0f(0x18f)](_0x2d3a0f(0x1a2),[z['object']({...catalogDescriptionBaseSchema,'kind':z['literal'](_0x2d3a0f(0x14b)),'componentPurposes':z[_0x2d3a0f(0x15f)](z['string'](),z['string']()),'definitions':catalogDefinitionsSchema[_0x2d3a0f(0x190)]()}),z['object']({...catalogDescriptionBaseSchema,'kind':z[_0x2d3a0f(0x153)](_0x2d3a0f(0x14e)),'definitions':catalogDefinitionsSchema})])},protocolVersionSchema=z['enum'](A2UI_SUPPORTED_PROTOCOL_VERSIONS),componentSchema=jsonObjectSchema,createSurfaceMessageSchema=z[_0x2d3a0f(0x14c)]({'version':protocolVersionSchema,'createSurface':z[_0x2d3a0f(0x14c)]({'surfaceId':z[_0x2d3a0f(0x186)](),'catalogId':z['string']()})['catchall'](jsonValueSchema)})[_0x2d3a0f(0x1a3)](jsonValueSchema),updateComponentsMessageSchema=z['object']({'version':protocolVersionSchema,'updateComponents':z['object']({'surfaceId':z['string'](),'components':z[_0x2d3a0f(0x14d)](componentSchema)})['catchall'](jsonValueSchema)})[_0x2d3a0f(0x1a3)](jsonValueSchema),updateDataModelMessageSchema=z['object']({'version':protocolVersionSchema,'updateDataModel':z['object']({'surfaceId':z['string'](),'path':z['string']()[_0x2d3a0f(0x190)](),'value':jsonValueSchema['optional']()})[_0x2d3a0f(0x1a3)](jsonValueSchema)})[_0x2d3a0f(0x1a3)](jsonValueSchema),deleteSurfaceMessageSchema=z['object']({'version':protocolVersionSchema,'deleteSurface':z[_0x2d3a0f(0x14c)]({'surfaceId':z[_0x2d3a0f(0x186)]()})['catchall'](jsonValueSchema)})[_0x2d3a0f(0x1a3)](jsonValueSchema);function createSendUIInputSchema(_0x26cafc=A2UI_DEFAULT_PROTOCOL_VERSION){const _0x152ed3=_0x2d3a0f;return{'surfaceId':z['string']()[_0x152ed3(0x190)]()['describe'](_0x152ed3(0x197)),'messages':z[_0x152ed3(0x14d)](z['union']([createSurfaceMessageSchema,updateComponentsMessageSchema,updateDataModelMessageSchema,deleteSurfaceMessageSchema]))[_0x152ed3(0x177)]([_0x152ed3(0x194)+_0x26cafc+_0x152ed3(0x155),'Every\x20message\x20you\x20generate\x20must\x20use\x20\x22version\x22:\x20\x22'+_0x26cafc+_0x152ed3(0x16d),'Use\x20this\x20only\x20as\x20workflow\x20step\x202,\x20after\x20fetching\x20component\x20schemas\x20with\x20'+GET_UI_CATALOG_TOOL_NAME+'.',_0x152ed3(0x193)+GET_UI_CATALOG_TOOL_NAME+';\x20do\x20not\x20guess\x20component\x20fields\x20from\x20this\x20tool\x20schema.',_0x152ed3(0x18a),_0x152ed3(0x161),_0x152ed3(0x18c)+GET_UI_CATALOG_TOOL_NAME+'\x20at\x20`createSurface.catalogId`.',_0x152ed3(0x1a4)][_0x152ed3(0x165)]('\x20'))};}function createGetCatalogInputSchema(){const _0x2fd559=_0x2d3a0f;return{'componentNames':z[_0x2fd559(0x14d)](z['string']())[_0x2fd559(0x19a)](0x1)[_0x2fd559(0x190)]()[_0x2fd559(0x177)](_0x2fd559(0x159)),'functionNames':z['array'](z['string']())['min'](0x1)['optional']()[_0x2fd559(0x177)](_0x2fd559(0x174))};}function createGenericToolDescription(_0xce1554){const _0x3ecdc4=_0x2d3a0f,_0x47fa91=_0xce1554['protocolVersion']??A2UI_DEFAULT_PROTOCOL_VERSION;return['Final\x20step:\x20render\x20UI\x20on\x20the\x20client\x20by\x20submitting\x20structured\x20A2UI\x20messages.',UI_TOOL_WORKFLOW,'Do\x20not\x20call\x20this\x20tool\x20before\x20'+GET_UI_CATALOG_TOOL_NAME+_0x3ecdc4(0x15a),'Catalog\x20id:\x20'+_0xce1554[_0x3ecdc4(0x17f)]['id']+'.',_0x3ecdc4(0x18d),'-\x20Every\x20message\x20you\x20generate\x20must\x20include\x20\x22version\x22:\x20\x22'+_0x47fa91+'\x22.',_0x3ecdc4(0x195),'-\x20createSurface.surfaceId\x20must\x20match\x20the\x20top-level\x20surfaceId\x20when\x20supplied.',_0x3ecdc4(0x187)+_0xce1554[_0x3ecdc4(0x17f)]['id']+'\x22.','-\x20Later\x20updateComponents/updateDataModel/deleteSurface\x20messages\x20must\x20target\x20the\x20same\x20surface.',_0x3ecdc4(0x18e),_0x3ecdc4(0x15d)][_0x3ecdc4(0x165)]('\x0a\x0a');}function createUIMCPNormalize(_0xe21901={}){const _0x2dab06=_0x2d3a0f;return createUISendNormalizer({'mode':_0xe21901[_0x2dab06(0x1a5)],'surfaceId':_0xe21901['surfaceId'],'catalog':_0xe21901[_0x2dab06(0x182)]});}const defaultNormalize=createUIMCPNormalize(),carrierValidators=new WeakMap();function getCarrierValidator(_0x34dae8){const _0x3222b8=_0x2d3a0f;if(_0x34dae8===void 0x0)return defaultNormalize;const _0xe4cdda=carrierValidators[_0x3222b8(0x166)](_0x34dae8);if(_0xe4cdda)return _0xe4cdda;const _0x454ec6=createUIMCPNormalize({'mode':_0x3222b8(0x17b),'catalog':_0x34dae8});return carrierValidators['set'](_0x34dae8,_0x454ec6),_0x454ec6;}function _0x410d(){const _0x55c7df=['Unsupported\x20schemaDelivery\x20\x22','kind','catchall','Component\x20objects\x20belong\x20inside\x20a\x20later\x20`updateComponents.components`\x20array.','mode','641952lembdU','normalize','A2UI\x20Catalog\x20','uiJson','directory','object','array','selection','\x20capability\x20family).','isArray','374897omNiYj','server','literal','\x22\x20(','\x20UI\x20message\x20array.','unknown','functionNames','union','Component\x20names\x20whose\x20field\x20rules\x20and\x20schemas\x20you\x20need.\x20Omit\x20on\x20the\x20first\x20call\x20to\x20get\x20the\x20catalog\x20directory\x20—\x20every\x20component\x20name\x20with\x20one\x20line\x20on\x20what\x20it\x20is\x20for\x20—\x20then\x20call\x20again\x20with\x20the\x20components\x20this\x20UI\x20actually\x20uses.','\x20in\x20the\x20same\x20task.\x20This\x20tool\x20validates\x20and\x20returns\x20A2UI\x20messages;\x20it\x20is\x20not\x20the\x20source\x20of\x20component\x20schemas.','json-schema','parse','Do\x20not\x20send\x20`ui_json`;\x20do\x20not\x20serialize\x20the\x20messages\x20into\x20a\x20JSON\x20string.','UI\x20normalizer\x20must\x20return\x20uiJson\x20and\x20uiMessages.','record','\x22.\x20Expected\x20\x22discovery\x22\x20or\x20\x22inline\x22.','Every\x20entry\x20contains\x20`version`\x20and\x20exactly\x20one\x20of\x20`createSurface`/`updateComponents`/`updateDataModel`/`deleteSurface`.','0.0.0','448roopDq','Basic\x20component\x20and\x20requested\x20function\x20definitions\x20are\x20JSON\x20Schemas\x20whose\x20references\x20resolve\x20from\x20the\x20whole\x20catalog.definitions\x20object,\x20including\x20its\x20shared\x20$defs.\x20Custom\x20component\x20schemas\x20retain\x20their\x20own\x20document\x20scope.','join','get','has','2xeRnDB','20mpCXys','length','boolean','a2ui://surface/','\x22;\x20no\x20other\x20wire\x20version\x20is\x20accepted.','message','Step\x201\x20of\x20the\x20A2UI\x20MCP\x20workflow.\x20Call\x20this\x20before\x20','add','discovery','prototype','With\x20no\x20componentNames\x20it\x20returns\x20the\x20catalog\x20directory:\x20the\x20catalog\x20id\x20and\x20every\x20component\x20name\x20with\x20one\x20line\x20saying\x20what\x20it\x20is\x20for.\x20Choose\x20all\x20components\x20the\x20UI\x20needs,\x20then\x20call\x20again\x20with\x20those\x20componentNames.','Optional\x20catalog\x20function\x20names\x20whose\x20full\x20schemas\x20you\x20need\x20(e.g.\x20formatDate,\x20formatNumber).\x20The\x20directory\x20instructions\x20list\x20available\x20functions\x20by\x20name\x20and\x20arguments;\x20requested\x20schemas\x20are\x20returned\x20in\x20catalog.definitions.functions.\x20Omit\x20when\x20the\x20UI\x20calls\x20no\x20functions.','733170CdIieR','1490620iiUjCc','describe','a2ui','call','supportedCatalogIds','strict','schemaDelivery','surfaceId','null','descriptor','href','text','catalog','Client\x20does\x20not\x20support\x20required\x20A2UI\x20Catalog\x20\x22','version','2996810ssONqr','string','-\x20createSurface.catalogId\x20must\x20be\x20\x22','registerTool','74532LeIklh','Do\x20not\x20pass\x20a\x20JSON\x20string\x20and\x20do\x20not\x20use\x20a\x20ui_json\x20field.','inline','The\x20first\x20entry\x20must\x20be\x20`createSurface`,\x20carrying\x20the\x20catalog\x20id\x20reported\x20by\x20','Message\x20list\x20rules:','-\x20Component\x20objects\x20belong\x20only\x20inside\x20updateComponents.components\x20and\x20must\x20conform\x20to\x20the\x20schemas\x20returned\x20by\x20get_ui_catalog.','discriminatedUnion','optional','ownKeys','Client\x20A2UI\x20capabilities\x20are\x20malformed:\x20clientCapabilities[\x22','Build\x20component\x20objects\x20from\x20the\x20schema\x20returned\x20by\x20','The\x20complete\x20A2UI\x20','-\x20The\x20first\x20message\x20must\x20be\x20createSurface.','parameters','Optional\x20expected\x20surface\x20id\x20for\x20this\x20UI\x20call.\x20When\x20supplied,\x20`messages[0].createSurface.surfaceId`\x20must\x20match\x20it.','506gztTGS','clientCapabilities','min','UI\x20normalizer\x20result\x20must\x20begin\x20with\x20createSurface.','18ivEYpR','81264GhINcd','@agentic-ui-experience/ui-mcp','isFinite','resource'];_0x410d=function(){return _0x55c7df;};return _0x410d();}function isJsonObject(_0x14dd22){const _0x1cf13d=_0x2d3a0f;return typeof _0x14dd22===_0x1cf13d(0x14c)&&_0x14dd22!==null&&!Array[_0x1cf13d(0x150)](_0x14dd22);}function isPlainJsonObject(_0x5c722a){const _0x288331=_0x2d3a0f;if(!isJsonObject(_0x5c722a))return![];const _0x11f004=Object['getPrototypeOf'](_0x5c722a);return _0x11f004===Object[_0x288331(0x172)]||_0x11f004===null;}function _0x3cda(_0x123a67,_0x5c7cb7){_0x123a67=_0x123a67-0x149;const _0x410d1a=_0x410d();let _0x3cda36=_0x410d1a[_0x123a67];return _0x3cda36;}function hasOwn(_0x30fa3c,_0x58088f){const _0x405ac9=_0x2d3a0f;return Object[_0x405ac9(0x172)]['hasOwnProperty'][_0x405ac9(0x179)](_0x30fa3c,_0x58088f);}function jsonValuesEqual(_0x221146,_0x27a5f3,_0x22b157=new WeakSet(),_0x5bf1ac=new WeakSet()){const _0x5ad35d=_0x2d3a0f;if(_0x221146===null||_0x27a5f3===null)return _0x221146===_0x27a5f3;if(typeof _0x221146!==typeof _0x27a5f3)return![];if(typeof _0x221146==='string'||typeof _0x221146===_0x5ad35d(0x16b))return _0x221146===_0x27a5f3;if(typeof _0x221146==='number')return Number['isFinite'](_0x221146)&&Number[_0x5ad35d(0x19f)](_0x27a5f3)&&_0x221146===_0x27a5f3;if(typeof _0x221146!=='object'||typeof _0x27a5f3!=='object')return![];if(_0x22b157['has'](_0x221146)||_0x5bf1ac[_0x5ad35d(0x167)](_0x27a5f3))return![];_0x22b157[_0x5ad35d(0x170)](_0x221146),_0x5bf1ac[_0x5ad35d(0x170)](_0x27a5f3);try{if(Array[_0x5ad35d(0x150)](_0x221146)||Array['isArray'](_0x27a5f3)){if(!Array['isArray'](_0x221146)||!Array[_0x5ad35d(0x150)](_0x27a5f3))return![];if(_0x221146[_0x5ad35d(0x16a)]!==_0x27a5f3[_0x5ad35d(0x16a)])return![];if(Reflect['ownKeys'](_0x221146)['length']!==_0x221146['length']+0x1)return![];if(Reflect[_0x5ad35d(0x191)](_0x27a5f3)['length']!==_0x27a5f3[_0x5ad35d(0x16a)]+0x1)return![];for(let _0x3f6d5f=0x0;_0x3f6d5f<_0x221146[_0x5ad35d(0x16a)];_0x3f6d5f+=0x1){if(!hasOwn(_0x221146,String(_0x3f6d5f)))return![];if(!hasOwn(_0x27a5f3,String(_0x3f6d5f)))return![];if(!jsonValuesEqual(_0x221146[_0x3f6d5f],_0x27a5f3[_0x3f6d5f],_0x22b157,_0x5bf1ac))return![];}return!![];}if(!isPlainJsonObject(_0x221146)||!isPlainJsonObject(_0x27a5f3))return![];const _0x40213a=Object['keys'](_0x221146),_0x186d06=Object['keys'](_0x27a5f3);if(Reflect['ownKeys'](_0x221146)[_0x5ad35d(0x16a)]!==_0x40213a['length'])return![];if(Reflect[_0x5ad35d(0x191)](_0x27a5f3)[_0x5ad35d(0x16a)]!==_0x186d06['length'])return![];if(_0x40213a[_0x5ad35d(0x16a)]!==_0x186d06['length'])return![];return _0x40213a['every'](_0x555e04=>hasOwn(_0x27a5f3,_0x555e04)&&jsonValuesEqual(_0x221146[_0x555e04],_0x27a5f3[_0x555e04],_0x22b157,_0x5bf1ac));}finally{_0x22b157['delete'](_0x221146),_0x5bf1ac['delete'](_0x27a5f3);}}function getNormalizedSurfaceId(_0x23a481,_0xa043d1,_0x13aa33){const _0x5951c6=_0x2d3a0f;if(typeof _0x23a481[_0x5951c6(0x14a)]!==_0x5951c6(0x186)||!Array[_0x5951c6(0x150)](_0x23a481['uiMessages']))throw new Error(_0x5951c6(0x15e));let _0x121e01;try{_0x121e01=JSON[_0x5951c6(0x15c)](_0x23a481[_0x5951c6(0x14a)]);}catch{throw new Error('UI\x20normalizer\x20uiJson\x20must\x20contain\x20valid\x20JSON.');}if(!jsonValuesEqual(_0x121e01,_0x23a481['uiMessages']))throw new Error('UI\x20normalizer\x20uiJson\x20and\x20uiMessages\x20must\x20represent\x20the\x20same\x20JSON\x20value.');if(!Array['isArray'](_0x121e01)||!isJsonObject(_0x121e01[0x0]))throw new Error(_0x5951c6(0x19b));const _0x26edde=_0x121e01[0x0]['createSurface'];if(!isJsonObject(_0x26edde)||typeof _0x26edde['surfaceId']!==_0x5951c6(0x186))throw new Error(_0x5951c6(0x19b));return getCarrierValidator(_0x13aa33['catalog'])({'messages':_0x121e01,..._0xa043d1===void 0x0?{}:{'surfaceId':_0xa043d1}}),_0x26edde[_0x5951c6(0x17d)];}function getA2UIClientCapability(_0x4c3d07,_0x369846){const _0x1b15b6=_0x2d3a0f;if(isJsonObject(_0x369846)&&hasOwn(_0x369846,'a2ui'))return _0x369846[_0x1b15b6(0x178)];const _0x4af2cf=_0x4c3d07[_0x1b15b6(0x152)]['getClientCapabilities']();if(!isJsonObject(_0x4af2cf))return void 0x0;if(hasOwn(_0x4af2cf,_0x1b15b6(0x178)))return _0x4af2cf[_0x1b15b6(0x178)];const _0x5c2466=_0x4af2cf['extensions'];return isJsonObject(_0x5c2466)&&hasOwn(_0x5c2466,A2UI_MCP_CAPABILITY_EXTENSION_ID)?_0x5c2466[A2UI_MCP_CAPABILITY_EXTENSION_ID]:void 0x0;}function validateA2UIClientCapability(_0xead42,_0x2e2a0e){const _0x3e9bd0=_0x2d3a0f;if(!isJsonObject(_0xead42))return'Client\x20must\x20declare\x20A2UI\x20'+A2UI_MCP_CAPABILITY_FAMILY+'\x20capability-family\x20support\x20for\x20Catalog\x20\x22'+_0x2e2a0e+'\x22.';const _0x5b293e=_0xead42[_0x3e9bd0(0x199)];if(!isJsonObject(_0x5b293e))return'Client\x20A2UI\x20capabilities\x20are\x20malformed:\x20clientCapabilities\x20is\x20required.';const _0x3bb77b=_0x5b293e[A2UI_MCP_CAPABILITY_FAMILY];if(!isJsonObject(_0x3bb77b)||!Array['isArray'](_0x3bb77b['supportedCatalogIds']))return _0x3e9bd0(0x192)+A2UI_MCP_CAPABILITY_FAMILY+'\x22].supportedCatalogIds\x20must\x20be\x20an\x20array.';if(!_0x3bb77b['supportedCatalogIds']['every'](_0x11ec73=>typeof _0x11ec73===_0x3e9bd0(0x186)))return'Client\x20A2UI\x20capabilities\x20are\x20malformed:\x20supportedCatalogIds\x20must\x20contain\x20only\x20strings.';if(!_0x3bb77b[_0x3e9bd0(0x17a)]['includes'](_0x2e2a0e))return _0x3e9bd0(0x183)+_0x2e2a0e+_0x3e9bd0(0x154)+A2UI_MCP_CAPABILITY_FAMILY+_0x3e9bd0(0x14f);return void 0x0;}function toToolError(_0x23a696){const _0x58f965=_0x2d3a0f;return{'isError':!![],'content':[{'type':_0x58f965(0x181),'text':_0x23a696}]};}function toToolResult(_0xa295cd,_0x4dfd5b,_0x4b667c){const _0x47d14d=_0x2d3a0f,_0x32ec01=getNormalizedSurfaceId(_0xa295cd,_0x4dfd5b,_0x4b667c),_0x50c28e={'type':_0x47d14d(0x1a0),'resource':{'uri':_0x47d14d(0x16c)+encodeURIComponent(_0x32ec01),'mimeType':A2UI_MESSAGE_MEDIA_TYPE,'text':_0xa295cd[_0x47d14d(0x14a)]}};return{'content':[{'type':'text','text':'Generated\x20an\x20interactive\x20A2UI\x20interface.'},_0x50c28e]};}function toCatalogToolResult(_0x3ee18f){const _0x38f711=_0x2d3a0f;return{'content':[{'type':_0x38f711(0x181),'text':JSON['stringify'](_0x3ee18f)}],'structuredContent':_0x3ee18f};}async function createUIToolCallResult(_0x5e7b7a,_0x76a0cd=defaultNormalize,_0x2aeaec={}){const _0x56e737=_0x2d3a0f;try{const _0x2c2bb4=_0x5e7b7a['surfaceId'],_0x580260=await _0x76a0cd(_0x5e7b7a);return toToolResult(_0x580260,_0x2c2bb4,_0x2aeaec);}catch(_0x2297bb){const _0x1504ca=_0x2297bb instanceof Error?_0x2297bb[_0x56e737(0x16e)]:String(_0x2297bb);return toToolError(_0x1504ca);}}function toMCPResourceResult(_0x22aba8){return _0x22aba8;}function registerUICatalogResources(_0x1474fe,_0x3f3dbd){const _0x2ac9d4=_0x2d3a0f,_0x1cbca5=_0x1474fe['registerResource']('a2ui-catalog',CATALOG_RESOURCE_URI,{'title':_0x2ac9d4(0x149)+_0x3f3dbd['descriptor']['id'],'description':'A2UI\x20catalog\x20instructions\x20and\x20component\x20schema.','mimeType':'application/json'},_0x21bc7a=>toMCPResourceResult(createUICatalogResourcePayload(_0x3f3dbd,_0x21bc7a[_0x2ac9d4(0x180)])));return{'catalog':_0x1cbca5};}function registerUICatalogTools(_0x585d42,_0x478066){const _0x3b8031=_0x2d3a0f,_0x1d1d72=_0x585d42['registerTool'](GET_UI_CATALOG_TOOL_NAME,{'title':'Get\x20A2UI\x20Catalog','description':[_0x3b8031(0x16f)+UI_TOOL_NAME+'.',UI_TOOL_WORKFLOW_ORDER,_0x3b8031(0x173),'With\x20componentNames\x20it\x20returns\x20only\x20the\x20selected\x20generation\x20contract:\x20A2UI\x20guidance\x20in\x20catalog.instructions\x20and\x20machine-readable\x20component/function\x20definitions\x20in\x20catalog.definitions.\x20The\x20directory\x20is\x20omitted\x20from\x20this\x20selected\x20response.',_0x3b8031(0x164)][_0x3b8031(0x165)]('\x0a\x0a'),'inputSchema':createGetCatalogInputSchema(),'outputSchema':getCatalogOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]}},async _0x2d6df1=>{const _0x310be9=_0x3b8031;try{return toCatalogToolResult(getUICatalog(_0x478066,{'componentNames':_0x2d6df1['componentNames'],'functionNames':_0x2d6df1[_0x310be9(0x157)]}));}catch(_0x345f47){const _0x2ad9ac=_0x345f47 instanceof Error?_0x345f47['message']:String(_0x345f47);return toToolError(_0x2ad9ac);}});return{'get':_0x1d1d72};}function resolveSchemaDelivery(_0xb1cbdd='discovery'){const _0x5cfdcc=_0x2d3a0f;if(_0xb1cbdd===_0x5cfdcc(0x171)||_0xb1cbdd===_0x5cfdcc(0x18b))return _0xb1cbdd;throw new Error(_0x5cfdcc(0x1a1)+String(_0xb1cbdd)+_0x5cfdcc(0x160));}function registerGenericUITool(_0x492088,_0x5d6a21,_0xd9068b={}){const _0x2a0e1d=_0x2d3a0f,_0x8b90db=resolveSchemaDelivery(_0xd9068b['schemaDelivery']),_0x48d9cc=_0x8b90db==='inline'?createUISendToolSpec(_0x5d6a21):void 0x0,_0x513569=_0xd9068b[_0x2a0e1d(0x1a7)]??createUISendNormalizer({'catalog':_0x5d6a21}),_0x5c5e61=_0x48d9cc?z[_0x2a0e1d(0x14c)]({'surfaceId':z['string']()[_0x2a0e1d(0x190)](),'messages':z[_0x2a0e1d(0x156)]()})['meta'](_0x48d9cc[_0x2a0e1d(0x196)]):z['object'](createSendUIInputSchema(_0x5d6a21['protocolVersion']??A2UI_DEFAULT_PROTOCOL_VERSION));return _0x492088[_0x2a0e1d(0x188)](UI_TOOL_NAME,{'title':_0xd9068b['title'],'description':_0x48d9cc?.['description']??createGenericToolDescription(_0x5d6a21),'inputSchema':_0x5c5e61,'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![],..._0xd9068b['annotations']}},async(_0x20419d,_0x13e459)=>{const _0x52ee3f=_0x2a0e1d,_0x2a3be8=validateA2UIClientCapability(getA2UIClientCapability(_0x492088,_0x13e459['_meta']),_0x5d6a21[_0x52ee3f(0x17f)]['id']);if(_0x2a3be8)return toToolError(_0x2a3be8);return createUIToolCallResult(_0x20419d,_0x513569,{'catalog':_0x5d6a21});});}function createUIMCPServer(_0x3d95ac={}){const _0x5454bd=_0x2d3a0f,_0x1a62d7=resolveSchemaDelivery(_0x3d95ac[_0x5454bd(0x17c)]),_0x53e790=createUIToolCatalog(_0x3d95ac['catalog'],_0x3d95ac['protocolVersion']),_0x1a5f2e=new McpServer({'name':_0x3d95ac[_0x5454bd(0x152)]?.['name']??_0x5454bd(0x19e),'version':_0x3d95ac[_0x5454bd(0x152)]?.[_0x5454bd(0x184)]??_0x5454bd(0x162)});registerUICatalogResources(_0x1a5f2e,_0x53e790);if(_0x1a62d7==='discovery')registerUICatalogTools(_0x1a5f2e,_0x53e790);return registerGenericUITool(_0x1a5f2e,_0x53e790,{..._0x3d95ac,'schemaDelivery':_0x1a62d7}),_0x1a5f2e;}export{_0xd83c53 as McpServer,createUIMCPNormalize,createUIMCPServer,createUIToolCallResult,registerGenericUITool,registerUICatalogResources,registerUICatalogTools};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-ui-experience/ui-mcp",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
],
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public",
|
|
25
|
-
"tag": "
|
|
25
|
+
"tag": "beta"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
29
29
|
"zod": "^4.4.3",
|
|
30
|
-
"@agentic-ui-experience/ui-core": "0.0.1-beta.
|
|
30
|
+
"@agentic-ui-experience/ui-core": "0.0.1-beta.7"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^24.10.1"
|