@univerjs-pro/mcp 0.10.11 → 0.10.12-nightly.202510251119
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/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/facade.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/controllers/mcp-tool-registry.controller.d.ts +4 -2
- package/lib/types/utils/json-utils.d.ts +13 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +4 -4
|
@@ -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
|
-
|
|
1
|
+
(function(_0x43113b,_0x767c44){const _0x1564e1=_0x1b5c,_0x473bed=_0x43113b();while(!![]){try{const _0x522ae0=parseInt(_0x1564e1(0x19b))/0x1+-parseInt(_0x1564e1(0x186))/0x2+-parseInt(_0x1564e1(0x1a6))/0x3+-parseInt(_0x1564e1(0x188))/0x4+parseInt(_0x1564e1(0x187))/0x5+-parseInt(_0x1564e1(0x1a9))/0x6*(parseInt(_0x1564e1(0x184))/0x7)+-parseInt(_0x1564e1(0x1a3))/0x8*(-parseInt(_0x1564e1(0x19c))/0x9);if(_0x522ae0===_0x767c44)break;else _0x473bed['push'](_0x473bed['shift']());}catch(_0x22e0c9){_0x473bed['push'](_0x473bed['shift']());}}}(_0x25db,0x89308),function(_0x53b16b,_0x5578b0){const _0x2dffc5=_0x1b5c;typeof exports==_0x2dffc5(0x17b)&&typeof module<'u'?_0x5578b0(require('@univerjs-pro/mcp'),require('@univerjs/core/facade'),require('@univerjs/core')):typeof define=='function'&&define[_0x2dffc5(0x17d)]?define([_0x2dffc5(0x196),_0x2dffc5(0x192),_0x2dffc5(0x198)],_0x5578b0):(_0x53b16b=typeof globalThis<'u'?globalThis:_0x53b16b||self,_0x5578b0(_0x53b16b[_0x2dffc5(0x199)],_0x53b16b[_0x2dffc5(0x1a5)],_0x53b16b[_0x2dffc5(0x18f)]));}(this,function(_0x26c751,_0x2ffe21,_0x488f44){'use strict';const _0x39bae5=_0x1b5c;class _0x291322{get[_0x39bae5(0x18d)](){const _0x3d7d3e=_0x39bae5;return _0x26c751[_0x3d7d3e(0x19d)][_0x3d7d3e(0x18d)];}get[_0x39bae5(0x185)](){const _0x2f1287=_0x39bae5;return _0x26c751[_0x2f1287(0x19d)][_0x2f1287(0x185)];}get[_0x39bae5(0x17e)](){const _0x42d7d2=_0x39bae5;return _0x26c751[_0x42d7d2(0x19d)][_0x42d7d2(0x17e)];}get[_0x39bae5(0x18e)](){const _0x5b6019=_0x39bae5;return _0x26c751[_0x5b6019(0x19d)][_0x5b6019(0x18e)];}}_0x2ffe21[_0x39bae5(0x17a)][_0x39bae5(0x1a2)](_0x291322);class _0x1ece07 extends _0x2ffe21['FUniver']{[_0x39bae5(0x19f)](_0x887c74){const _0x24dbe5=_0x39bae5;this[_0x24dbe5(0x180)](_0x887c74);}[_0x39bae5(0x180)](_0x4ab87f){const _0x221e90=_0x39bae5,_0x4d5306=_0x4ab87f[_0x221e90(0x18a)](_0x26c751['MCPEventService']);this[_0x221e90(0x17c)](this['Event'][_0x221e90(0x18d)],()=>_0x488f44['toDisposable'](_0x4d5306[_0x221e90(0x181)][_0x221e90(0x1a1)](_0x270d08=>{const _0x14723c=_0x221e90;_0x270d08[_0x14723c(0x190)]===_0x26c751[_0x14723c(0x19d)][_0x14723c(0x18d)]&&this['fireEvent'](this[_0x14723c(0x1a4)][_0x14723c(0x18d)],_0x270d08[_0x14723c(0x19e)]);}))),this['registerEventHandler'](this[_0x221e90(0x1a4)][_0x221e90(0x185)],()=>_0x488f44[_0x221e90(0x19a)](_0x4d5306[_0x221e90(0x181)]['subscribe'](_0x24018c=>{const _0x65ced=_0x221e90;_0x24018c['type']===_0x26c751[_0x65ced(0x19d)][_0x65ced(0x185)]&&this[_0x65ced(0x197)](this[_0x65ced(0x1a4)][_0x65ced(0x185)],_0x24018c[_0x65ced(0x19e)]);}))),this[_0x221e90(0x17c)](this[_0x221e90(0x1a4)][_0x221e90(0x17e)],()=>_0x488f44['toDisposable'](_0x4d5306['event$'][_0x221e90(0x1a1)](_0x5b4c71=>{const _0x4ab57a=_0x221e90;_0x5b4c71[_0x4ab57a(0x190)]===_0x26c751[_0x4ab57a(0x19d)]['McpToolCallExecuted']&&this[_0x4ab57a(0x197)](this[_0x4ab57a(0x1a4)][_0x4ab57a(0x17e)],_0x5b4c71[_0x4ab57a(0x19e)]);}))),this[_0x221e90(0x17c)](this[_0x221e90(0x1a4)][_0x221e90(0x18e)],()=>_0x488f44[_0x221e90(0x19a)](_0x4d5306['event$'][_0x221e90(0x1a1)](_0x1a9cdd=>{const _0x43bffc=_0x221e90;_0x1a9cdd[_0x43bffc(0x190)]===_0x26c751[_0x43bffc(0x19d)][_0x43bffc(0x18e)]&&this[_0x43bffc(0x197)](this[_0x43bffc(0x1a4)][_0x43bffc(0x18e)],_0x1a9cdd['data']);})));}[_0x39bae5(0x18b)](_0xbe3af4,_0x303d77){const _0x13e133=_0x39bae5;return this[_0x13e133(0x18c)][_0x13e133(0x18a)](_0x26c751['IMCPToolRegistry'])['validateToolCall'](_0xbe3af4,_0x303d77);}[_0x39bae5(0x182)](){const _0x3dbe3a=_0x39bae5;return this['_injector'][_0x3dbe3a(0x18a)](_0x26c751[_0x3dbe3a(0x189)])[_0x3dbe3a(0x183)]();}[_0x39bae5(0x17f)](_0x50b1a2,_0x2489b7){const _0x33b882=_0x39bae5;return this['_injector'][_0x33b882(0x18a)](_0x26c751[_0x33b882(0x189)])[_0x33b882(0x193)](_0x50b1a2,_0x2489b7);}[_0x39bae5(0x1a0)](){const _0x6083e0=_0x39bae5;return this[_0x6083e0(0x18c)][_0x6083e0(0x18a)](_0x26c751[_0x6083e0(0x1a8)])[_0x6083e0(0x194)]();}[_0x39bae5(0x191)](){const _0xb73a22=_0x39bae5;this[_0xb73a22(0x18c)][_0xb73a22(0x18a)](_0x26c751[_0xb73a22(0x1a8)])['connect']();}[_0x39bae5(0x195)](){const _0x2e057a=_0x39bae5;this[_0x2e057a(0x18c)]['get'](_0x26c751[_0x2e057a(0x1a8)])['disconnect']();}}_0x2ffe21[_0x39bae5(0x1a7)][_0x39bae5(0x1a2)](_0x1ece07);}));function _0x1b5c(_0x4da5c1,_0x3c9062){const _0x25dbda=_0x25db();return _0x1b5c=function(_0x1b5cb8,_0x4ee4a9){_0x1b5cb8=_0x1b5cb8-0x17a;let _0x3f2bd7=_0x25dbda[_0x1b5cb8];return _0x3f2bd7;},_0x1b5c(_0x4da5c1,_0x3c9062);}function _0x25db(){const _0x4a893a=['@univerjs/core','UniverProMcp','toDisposable','1222BfNtDa','99tVLOXw','MCPEventId','data','_initialize','getMCPConnectionStatus','subscribe','extend','797072HELhok','Event','UniverCoreFacade','968334BtRAxy','FUniver','MCPConnectionController','746454EPJWTD','FEventName','object','registerEventHandler','amd','McpToolCallExecuted','callMCPTool','_registerMCPFacadeEvents','event$','getAllMCPTools','getAllTools','14XCPEQy','McpToolCallReceived','398666mYOKcI','3298505lddbZv','1696160OeXMVS','IMCPToolRegistry','get','validateMCPToolCall','_injector','McpConnectionStatusChanged','McpToolCallFailed','UniverCore','type','connectMCP','@univerjs/core/facade','executeTool','getConnectionStatus','disconnectMCP','@univerjs-pro/mcp','fireEvent'];_0x25db=function(){return _0x4a893a;};return _0x25db();}
|