@univerjs-pro/mcp 0.10.12 → 0.10.13-nightly.202510290902

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.
@@ -1,4 +1,4 @@
1
- import { Disposable, ILogService } from '@univerjs/core';
1
+ import { Disposable, IConfigService, ILogService, Injector } from '@univerjs/core';
2
2
  import { z } from 'zod';
3
3
  import { MCPEventService } from '../services/mcp-event.service';
4
4
  /**
@@ -38,8 +38,10 @@ export declare const IMCPToolRegistry: import('@wendellhu/redi').IdentifierDecor
38
38
  export declare class MCPToolRegistryController extends Disposable implements IMCPToolRegistry {
39
39
  private readonly _logService;
40
40
  private readonly _mcpEventService;
41
+ readonly _injector: Injector;
42
+ private readonly _configService;
41
43
  private readonly _tools;
42
- constructor(_logService: ILogService, _mcpEventService: MCPEventService);
44
+ constructor(_logService: ILogService, _mcpEventService: MCPEventService, _injector: Injector, _configService: IConfigService);
43
45
  /**
44
46
  * Register a tool for MCP calls
45
47
  */
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Safe JSON stringification utilities for MCP protocol
3
+ * Handles circular references and complex objects with minimal overhead
4
+ */
5
+ /**
6
+ * Safely stringify JSON with strict filtering for complex objects
7
+ * Only allows basic types, plain Objects, and Arrays to be serialized
8
+ * All other types are converted to descriptive strings at the first level
9
+ * @param value - The value to stringify
10
+ * @param space - Optional spacing for formatting
11
+ * @returns JSON string with safe handling of complex objects
12
+ */
13
+ export declare function safeJsonStringify(value: any, space?: string | number): string;
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(_0x5377fb,_0xeba218){const _0x26ee1f=_0x145b,_0x659f83=_0x5377fb();while(!![]){try{const _0xf01aa7=-parseInt(_0x26ee1f(0x190))/0x1+-parseInt(_0x26ee1f(0x1ac))/0x2+-parseInt(_0x26ee1f(0x186))/0x3+parseInt(_0x26ee1f(0x19d))/0x4*(parseInt(_0x26ee1f(0x184))/0x5)+-parseInt(_0x26ee1f(0x1b2))/0x6+-parseInt(_0x26ee1f(0x1ad))/0x7*(parseInt(_0x26ee1f(0x1a2))/0x8)+parseInt(_0x26ee1f(0x19a))/0x9*(parseInt(_0x26ee1f(0x188))/0xa);if(_0xf01aa7===_0xeba218)break;else _0x659f83['push'](_0x659f83['shift']());}catch(_0x50eb61){_0x659f83['push'](_0x659f83['shift']());}}}(_0x22df,0xecca2),function(_0x1ae06f,_0x5ba99a){const _0x5b93b9=_0x145b;typeof exports==_0x5b93b9(0x1a4)&&typeof module<'u'?_0x5ba99a(require('@univerjs-pro/mcp'),require('@univerjs/core/facade'),require('@univerjs/core')):typeof define==_0x5b93b9(0x199)&&define[_0x5b93b9(0x191)]?define([_0x5b93b9(0x1a1),_0x5b93b9(0x1b0),_0x5b93b9(0x1b4)],_0x5ba99a):(_0x1ae06f=typeof globalThis<'u'?globalThis:_0x1ae06f||self,_0x5ba99a(_0x1ae06f[_0x5b93b9(0x18e)],_0x1ae06f[_0x5b93b9(0x1a5)],_0x1ae06f['UniverCore']));}(this,function(_0x575755,_0xb78d21,_0x3260d){'use strict';const _0x54adce=_0x145b;class _0x1a0417{get[_0x54adce(0x1a8)](){const _0x2d5d2a=_0x54adce;return _0x575755[_0x2d5d2a(0x18d)][_0x2d5d2a(0x1a8)];}get[_0x54adce(0x195)](){const _0x50f694=_0x54adce;return _0x575755['MCPEventId'][_0x50f694(0x195)];}get[_0x54adce(0x1b3)](){const _0x41c201=_0x54adce;return _0x575755[_0x41c201(0x18d)][_0x41c201(0x1b3)];}get['McpToolCallFailed'](){const _0x33a868=_0x54adce;return _0x575755[_0x33a868(0x18d)][_0x33a868(0x19e)];}}_0xb78d21[_0x54adce(0x1a3)]['extend'](_0x1a0417);class _0x5568ea extends _0xb78d21[_0x54adce(0x1a7)]{[_0x54adce(0x19b)](_0x20af0b){const _0x332e4e=_0x54adce;this[_0x332e4e(0x18a)](_0x20af0b);}[_0x54adce(0x18a)](_0x36d9e9){const _0x231e4e=_0x54adce,_0x289512=_0x36d9e9[_0x231e4e(0x1ae)](_0x575755[_0x231e4e(0x1a0)]);this['registerEventHandler'](this[_0x231e4e(0x193)][_0x231e4e(0x1a8)],()=>_0x3260d[_0x231e4e(0x1b1)](_0x289512['event$'][_0x231e4e(0x197)](_0x190a8c=>{const _0x203bef=_0x231e4e;_0x190a8c['type']===_0x575755[_0x203bef(0x18d)][_0x203bef(0x1a8)]&&this[_0x203bef(0x189)](this[_0x203bef(0x193)][_0x203bef(0x1a8)],_0x190a8c['data']);}))),this['registerEventHandler'](this[_0x231e4e(0x193)][_0x231e4e(0x195)],()=>_0x3260d['toDisposable'](_0x289512['event$'][_0x231e4e(0x197)](_0xe32fe4=>{const _0x591314=_0x231e4e;_0xe32fe4['type']===_0x575755[_0x591314(0x18d)]['McpToolCallReceived']&&this[_0x591314(0x189)](this[_0x591314(0x193)][_0x591314(0x195)],_0xe32fe4[_0x591314(0x194)]);}))),this[_0x231e4e(0x1ab)](this[_0x231e4e(0x193)][_0x231e4e(0x1b3)],()=>_0x3260d[_0x231e4e(0x1b1)](_0x289512[_0x231e4e(0x19c)][_0x231e4e(0x197)](_0x2a0163=>{const _0x436652=_0x231e4e;_0x2a0163['type']===_0x575755[_0x436652(0x18d)]['McpToolCallExecuted']&&this[_0x436652(0x189)](this[_0x436652(0x193)][_0x436652(0x1b3)],_0x2a0163[_0x436652(0x194)]);}))),this[_0x231e4e(0x1ab)](this['Event'][_0x231e4e(0x19e)],()=>_0x3260d['toDisposable'](_0x289512[_0x231e4e(0x19c)]['subscribe'](_0x3836dc=>{const _0x23c574=_0x231e4e;_0x3836dc[_0x23c574(0x187)]===_0x575755[_0x23c574(0x18d)][_0x23c574(0x19e)]&&this[_0x23c574(0x189)](this[_0x23c574(0x193)][_0x23c574(0x19e)],_0x3836dc['data']);})));}[_0x54adce(0x192)](_0x5ef1e4,_0x1bc2f0){const _0x3610e2=_0x54adce;return this['_injector'][_0x3610e2(0x1ae)](_0x575755[_0x3610e2(0x18f)])['validateToolCall'](_0x5ef1e4,_0x1bc2f0);}[_0x54adce(0x1a9)](){const _0x1a9c25=_0x54adce;return this[_0x1a9c25(0x185)]['get'](_0x575755[_0x1a9c25(0x18f)])[_0x1a9c25(0x19f)]();}[_0x54adce(0x196)](_0x2f1db0,_0x303f61){const _0x38a234=_0x54adce;return this['_injector'][_0x38a234(0x1ae)](_0x575755[_0x38a234(0x18f)])['executeTool'](_0x2f1db0,_0x303f61);}[_0x54adce(0x1b5)](){const _0x3628c0=_0x54adce;return this[_0x3628c0(0x185)][_0x3628c0(0x1ae)](_0x575755[_0x3628c0(0x18c)])['getConnectionStatus']();}[_0x54adce(0x1a6)](){const _0xa13661=_0x54adce;this['_injector'][_0xa13661(0x1ae)](_0x575755[_0xa13661(0x18c)])[_0xa13661(0x1af)]();}[_0x54adce(0x18b)](){const _0x3a4ef4=_0x54adce;this[_0x3a4ef4(0x185)][_0x3a4ef4(0x1ae)](_0x575755['MCPConnectionController'])[_0x3a4ef4(0x1aa)]();}}_0xb78d21['FUniver'][_0x54adce(0x198)](_0x5568ea);}));function _0x145b(_0x5a95f4,_0x55e40b){const _0x22df38=_0x22df();return _0x145b=function(_0x145bb0,_0x246eff){_0x145bb0=_0x145bb0-0x184;let _0x4ab635=_0x22df38[_0x145bb0];return _0x4ab635;},_0x145b(_0x5a95f4,_0x55e40b);}function _0x22df(){const _0x3346fc=['function','6381mpEcWz','_initialize','event$','4iIcLPo','McpToolCallFailed','getAllTools','MCPEventService','@univerjs-pro/mcp','2296120mhDpDs','FEventName','object','UniverCoreFacade','connectMCP','FUniver','McpConnectionStatusChanged','getAllMCPTools','disconnect','registerEventHandler','1976772xJmUAE','35BkIeIK','get','connect','@univerjs/core/facade','toDisposable','5043156GRLevL','McpToolCallExecuted','@univerjs/core','getMCPConnectionStatus','458165Jikuan','_injector','160548GSnUiY','type','76730uSJWQV','fireEvent','_registerMCPFacadeEvents','disconnectMCP','MCPConnectionController','MCPEventId','UniverProMcp','IMCPToolRegistry','1244397SlCXYi','amd','validateMCPToolCall','Event','data','McpToolCallReceived','callMCPTool','subscribe','extend'];_0x22df=function(){return _0x3346fc;};return _0x22df();}
1
+ function _0x3631(_0x20c0f5,_0x5d3a30){const _0x22b848=_0x22b8();return _0x3631=function(_0x363148,_0x8c9072){_0x363148=_0x363148-0x150;let _0x2c9dbe=_0x22b848[_0x363148];return _0x2c9dbe;},_0x3631(_0x20c0f5,_0x5d3a30);}function _0x22b8(){const _0x5bda0d=['@univerjs/core','type','10892312ZoGcYu','function','event$','extend','_initialize','7aJBWeh','getAllMCPTools','subscribe','object','get','executeTool','@univerjs/core/facade','26oGYsuQ','_injector','McpToolCallFailed','connectMCP','_registerMCPFacadeEvents','validateMCPToolCall','15294429cqhjiH','amd','Event','6339515MllGNV','toDisposable','registerEventHandler','callMCPTool','validateToolCall','4329972pfWEbS','IMCPToolRegistry','getAllTools','752810PVWQvK','UniverCore','getMCPConnectionStatus','MCPConnectionController','141546DXLYiU','McpConnectionStatusChanged','10LbSmsH','FEventName','MCPEventId','data','5699756yMYEjm','connect','McpToolCallExecuted','disconnect','FUniver','fireEvent','McpToolCallReceived','MCPEventService'];_0x22b8=function(){return _0x5bda0d;};return _0x22b8();}(function(_0x1598b5,_0x34af71){const _0x275be3=_0x3631,_0x31332b=_0x1598b5();while(!![]){try{const _0x4174ab=-parseInt(_0x275be3(0x175))/0x1+-parseInt(_0x275be3(0x164))/0x2*(-parseInt(_0x275be3(0x179))/0x3)+-parseInt(_0x275be3(0x17f))/0x4+-parseInt(_0x275be3(0x16d))/0x5+parseInt(_0x275be3(0x172))/0x6*(parseInt(_0x275be3(0x15d))/0x7)+parseInt(_0x275be3(0x158))/0x8+-parseInt(_0x275be3(0x16a))/0x9*(-parseInt(_0x275be3(0x17b))/0xa);if(_0x4174ab===_0x34af71)break;else _0x31332b['push'](_0x31332b['shift']());}catch(_0x3a898f){_0x31332b['push'](_0x31332b['shift']());}}}(_0x22b8,0xe8018),function(_0x317260,_0x26f31a){const _0x286035=_0x3631;typeof exports==_0x286035(0x160)&&typeof module<'u'?_0x26f31a(require('@univerjs-pro/mcp'),require('@univerjs/core/facade'),require('@univerjs/core')):typeof define==_0x286035(0x159)&&define[_0x286035(0x16b)]?define(['@univerjs-pro/mcp',_0x286035(0x163),_0x286035(0x156)],_0x26f31a):(_0x317260=typeof globalThis<'u'?globalThis:_0x317260||self,_0x26f31a(_0x317260['UniverProMcp'],_0x317260['UniverCoreFacade'],_0x317260[_0x286035(0x176)]));}(this,function(_0x27fe53,_0x3fc3ce,_0x36678e){'use strict';const _0x1d3130=_0x3631;class _0xdba144{get['McpConnectionStatusChanged'](){const _0x80f683=_0x3631;return _0x27fe53[_0x80f683(0x17d)][_0x80f683(0x17a)];}get['McpToolCallReceived'](){const _0x4cd2e3=_0x3631;return _0x27fe53[_0x4cd2e3(0x17d)]['McpToolCallReceived'];}get[_0x1d3130(0x150)](){const _0x36304e=_0x1d3130;return _0x27fe53[_0x36304e(0x17d)][_0x36304e(0x150)];}get['McpToolCallFailed'](){const _0x5d3b61=_0x1d3130;return _0x27fe53[_0x5d3b61(0x17d)]['McpToolCallFailed'];}}_0x3fc3ce[_0x1d3130(0x17c)][_0x1d3130(0x15b)](_0xdba144);class _0x18485e extends _0x3fc3ce[_0x1d3130(0x152)]{[_0x1d3130(0x15c)](_0x21480e){const _0x420dad=_0x1d3130;this[_0x420dad(0x168)](_0x21480e);}[_0x1d3130(0x168)](_0x33c6ac){const _0xd97017=_0x1d3130,_0x3680fe=_0x33c6ac['get'](_0x27fe53[_0xd97017(0x155)]);this['registerEventHandler'](this['Event']['McpConnectionStatusChanged'],()=>_0x36678e[_0xd97017(0x16e)](_0x3680fe['event$']['subscribe'](_0x438f1=>{const _0x18b6fa=_0xd97017;_0x438f1[_0x18b6fa(0x157)]===_0x27fe53[_0x18b6fa(0x17d)]['McpConnectionStatusChanged']&&this['fireEvent'](this[_0x18b6fa(0x16c)]['McpConnectionStatusChanged'],_0x438f1[_0x18b6fa(0x17e)]);}))),this[_0xd97017(0x16f)](this[_0xd97017(0x16c)][_0xd97017(0x154)],()=>_0x36678e[_0xd97017(0x16e)](_0x3680fe[_0xd97017(0x15a)][_0xd97017(0x15f)](_0x27f875=>{const _0xbfc59d=_0xd97017;_0x27f875[_0xbfc59d(0x157)]===_0x27fe53[_0xbfc59d(0x17d)]['McpToolCallReceived']&&this['fireEvent'](this['Event']['McpToolCallReceived'],_0x27f875[_0xbfc59d(0x17e)]);}))),this[_0xd97017(0x16f)](this[_0xd97017(0x16c)][_0xd97017(0x150)],()=>_0x36678e[_0xd97017(0x16e)](_0x3680fe[_0xd97017(0x15a)][_0xd97017(0x15f)](_0x36b967=>{const _0x5b8309=_0xd97017;_0x36b967['type']===_0x27fe53[_0x5b8309(0x17d)][_0x5b8309(0x150)]&&this[_0x5b8309(0x153)](this[_0x5b8309(0x16c)]['McpToolCallExecuted'],_0x36b967[_0x5b8309(0x17e)]);}))),this[_0xd97017(0x16f)](this[_0xd97017(0x16c)][_0xd97017(0x166)],()=>_0x36678e['toDisposable'](_0x3680fe[_0xd97017(0x15a)][_0xd97017(0x15f)](_0x32ab4d=>{const _0x20b842=_0xd97017;_0x32ab4d[_0x20b842(0x157)]===_0x27fe53[_0x20b842(0x17d)][_0x20b842(0x166)]&&this['fireEvent'](this[_0x20b842(0x16c)][_0x20b842(0x166)],_0x32ab4d[_0x20b842(0x17e)]);})));}[_0x1d3130(0x169)](_0x461bb1,_0x47b72a){const _0x5aa091=_0x1d3130;return this['_injector']['get'](_0x27fe53[_0x5aa091(0x173)])[_0x5aa091(0x171)](_0x461bb1,_0x47b72a);}[_0x1d3130(0x15e)](){const _0x60b796=_0x1d3130;return this[_0x60b796(0x165)][_0x60b796(0x161)](_0x27fe53[_0x60b796(0x173)])[_0x60b796(0x174)]();}[_0x1d3130(0x170)](_0x271579,_0x3b663c){const _0x52d547=_0x1d3130;return this[_0x52d547(0x165)][_0x52d547(0x161)](_0x27fe53[_0x52d547(0x173)])[_0x52d547(0x162)](_0x271579,_0x3b663c);}[_0x1d3130(0x177)](){const _0x2aa9be=_0x1d3130;return this[_0x2aa9be(0x165)][_0x2aa9be(0x161)](_0x27fe53[_0x2aa9be(0x178)])['getConnectionStatus']();}[_0x1d3130(0x167)](){const _0x4df6c5=_0x1d3130;this[_0x4df6c5(0x165)][_0x4df6c5(0x161)](_0x27fe53['MCPConnectionController'])[_0x4df6c5(0x180)]();}['disconnectMCP'](){const _0x5d4aad=_0x1d3130;this['_injector'][_0x5d4aad(0x161)](_0x27fe53[_0x5d4aad(0x178)])[_0x5d4aad(0x151)]();}}_0x3fc3ce['FUniver']['extend'](_0x18485e);}));