@ton/mcp 0.1.15-alpha.14 → 0.1.15-alpha.15
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 +21 -21
- package/dist/index.cjs +21 -21
- package/dist/index.js +21 -21
- package/dist/serverless.cjs +21 -21
- package/dist/serverless.js +21 -21
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -81477,6 +81477,7 @@ var BridgeManager = class {
|
|
|
81477
81477
|
jsBridgeTransport;
|
|
81478
81478
|
eventQueue = [];
|
|
81479
81479
|
isProcessing = false;
|
|
81480
|
+
isActive = false;
|
|
81480
81481
|
eventStore;
|
|
81481
81482
|
eventRouter;
|
|
81482
81483
|
eventEmitter;
|
|
@@ -81500,14 +81501,27 @@ var BridgeManager = class {
|
|
|
81500
81501
|
this.analytics = analyticsManager?.scoped({ bridge_url: this.config.bridgeUrl });
|
|
81501
81502
|
this.walletKitConfig = walletKitConfig;
|
|
81502
81503
|
this.jsBridgeTransport = config?.jsBridgeTransport;
|
|
81504
|
+
if (this.config.bridgeUrl && !this.config.disableHttpConnection) this.bridgeProvider = new C$1(this.config.bridgeUrl, this.queueBridgeEvent.bind(this), (error) => {
|
|
81505
|
+
log$26.error("Bridge listener error", { error: error.toString() });
|
|
81506
|
+
this.analytics?.emitBridgeClientConnectError({
|
|
81507
|
+
error_message: `${error?.toString() || "Unknown error"}${error?.errorCode ? ` (Code: ${error?.errorCode})` : ""}`,
|
|
81508
|
+
trace_id: error?.traceId,
|
|
81509
|
+
client_id: error?.clientId
|
|
81510
|
+
});
|
|
81511
|
+
});
|
|
81503
81512
|
if (!this.jsBridgeTransport && config?.enableJsBridge) throw new WalletKitError(ERROR_CODES.INVALID_CONFIG, "JS Bridge transport is not configured");
|
|
81504
81513
|
}
|
|
81505
81514
|
/**
|
|
81506
81515
|
* Initialize bridge connection
|
|
81507
81516
|
*/
|
|
81508
81517
|
async start() {
|
|
81509
|
-
if (this.
|
|
81510
|
-
log$26.warn("Bridge already
|
|
81518
|
+
if (this.isActive === true) {
|
|
81519
|
+
log$26.warn("Bridge already started");
|
|
81520
|
+
return;
|
|
81521
|
+
}
|
|
81522
|
+
this.isActive = true;
|
|
81523
|
+
if (this.isConnected === true) {
|
|
81524
|
+
log$26.warn("Bridge already connected");
|
|
81511
81525
|
return;
|
|
81512
81526
|
}
|
|
81513
81527
|
try {
|
|
@@ -81518,6 +81532,7 @@ var BridgeManager = class {
|
|
|
81518
81532
|
this.reconnectAttempts = 0;
|
|
81519
81533
|
}
|
|
81520
81534
|
} catch (error) {
|
|
81535
|
+
this.isActive = false;
|
|
81521
81536
|
log$26.error("Failed to start bridge", { error });
|
|
81522
81537
|
throw error;
|
|
81523
81538
|
}
|
|
@@ -81604,12 +81619,10 @@ var BridgeManager = class {
|
|
|
81604
81619
|
* Close bridge connection
|
|
81605
81620
|
*/
|
|
81606
81621
|
async close() {
|
|
81607
|
-
if (this.bridgeProvider)
|
|
81608
|
-
await this.bridgeProvider.close();
|
|
81609
|
-
this.bridgeProvider = void 0;
|
|
81610
|
-
}
|
|
81622
|
+
if (this.bridgeProvider) await this.bridgeProvider.close();
|
|
81611
81623
|
this.eventQueue = [];
|
|
81612
81624
|
this.isProcessing = false;
|
|
81625
|
+
this.isActive = false;
|
|
81613
81626
|
this.isConnected = false;
|
|
81614
81627
|
this.reconnectAttempts = 0;
|
|
81615
81628
|
if (this.requestProcessingTimeoutId) {
|
|
@@ -81639,7 +81652,7 @@ var BridgeManager = class {
|
|
|
81639
81652
|
* Connect to TON Connect bridge
|
|
81640
81653
|
*/
|
|
81641
81654
|
async connectToSSEBridge() {
|
|
81642
|
-
if (!this.
|
|
81655
|
+
if (!this.bridgeProvider) throw new WalletKitError(ERROR_CODES.BRIDGE_NOT_INITIALIZED, "Bridge not initialized before connecting to SSE");
|
|
81643
81656
|
const connectTraceId = v7();
|
|
81644
81657
|
try {
|
|
81645
81658
|
const clients = await this.getClients();
|
|
@@ -81654,20 +81667,7 @@ var BridgeManager = class {
|
|
|
81654
81667
|
client_id: client?.clientId
|
|
81655
81668
|
});
|
|
81656
81669
|
}
|
|
81657
|
-
this.bridgeProvider
|
|
81658
|
-
bridgeUrl: this.config.bridgeUrl,
|
|
81659
|
-
clients,
|
|
81660
|
-
listener: this.queueBridgeEvent.bind(this),
|
|
81661
|
-
errorListener: (error) => {
|
|
81662
|
-
log$26.error("Bridge listener error", { error: error.toString() });
|
|
81663
|
-
this.analytics?.emitBridgeClientConnectError({
|
|
81664
|
-
error_message: `${error?.toString() || "Unknown error"}${error?.errorCode ? ` (Code: ${error?.errorCode})` : ""}`,
|
|
81665
|
-
trace_id: error?.traceId ?? connectTraceId,
|
|
81666
|
-
client_id: error?.clientId
|
|
81667
|
-
});
|
|
81668
|
-
},
|
|
81669
|
-
options: { lastEventId: this.lastEventId }
|
|
81670
|
-
});
|
|
81670
|
+
await this.bridgeProvider?.restoreConnection(clients, { lastEventId: this.lastEventId });
|
|
81671
81671
|
this.isConnected = true;
|
|
81672
81672
|
this.reconnectAttempts = 0;
|
|
81673
81673
|
log$26.info("Bridge connected successfully");
|
package/dist/index.cjs
CHANGED
|
@@ -81984,6 +81984,7 @@ var BridgeManager = class {
|
|
|
81984
81984
|
jsBridgeTransport;
|
|
81985
81985
|
eventQueue = [];
|
|
81986
81986
|
isProcessing = false;
|
|
81987
|
+
isActive = false;
|
|
81987
81988
|
eventStore;
|
|
81988
81989
|
eventRouter;
|
|
81989
81990
|
eventEmitter;
|
|
@@ -82007,14 +82008,27 @@ var BridgeManager = class {
|
|
|
82007
82008
|
this.analytics = analyticsManager?.scoped({ bridge_url: this.config.bridgeUrl });
|
|
82008
82009
|
this.walletKitConfig = walletKitConfig;
|
|
82009
82010
|
this.jsBridgeTransport = config?.jsBridgeTransport;
|
|
82011
|
+
if (this.config.bridgeUrl && !this.config.disableHttpConnection) this.bridgeProvider = new C$1(this.config.bridgeUrl, this.queueBridgeEvent.bind(this), (error) => {
|
|
82012
|
+
log$25.error("Bridge listener error", { error: error.toString() });
|
|
82013
|
+
this.analytics?.emitBridgeClientConnectError({
|
|
82014
|
+
error_message: `${error?.toString() || "Unknown error"}${error?.errorCode ? ` (Code: ${error?.errorCode})` : ""}`,
|
|
82015
|
+
trace_id: error?.traceId,
|
|
82016
|
+
client_id: error?.clientId
|
|
82017
|
+
});
|
|
82018
|
+
});
|
|
82010
82019
|
if (!this.jsBridgeTransport && config?.enableJsBridge) throw new WalletKitError(ERROR_CODES.INVALID_CONFIG, "JS Bridge transport is not configured");
|
|
82011
82020
|
}
|
|
82012
82021
|
/**
|
|
82013
82022
|
* Initialize bridge connection
|
|
82014
82023
|
*/
|
|
82015
82024
|
async start() {
|
|
82016
|
-
if (this.
|
|
82017
|
-
log$25.warn("Bridge already
|
|
82025
|
+
if (this.isActive === true) {
|
|
82026
|
+
log$25.warn("Bridge already started");
|
|
82027
|
+
return;
|
|
82028
|
+
}
|
|
82029
|
+
this.isActive = true;
|
|
82030
|
+
if (this.isConnected === true) {
|
|
82031
|
+
log$25.warn("Bridge already connected");
|
|
82018
82032
|
return;
|
|
82019
82033
|
}
|
|
82020
82034
|
try {
|
|
@@ -82025,6 +82039,7 @@ var BridgeManager = class {
|
|
|
82025
82039
|
this.reconnectAttempts = 0;
|
|
82026
82040
|
}
|
|
82027
82041
|
} catch (error) {
|
|
82042
|
+
this.isActive = false;
|
|
82028
82043
|
log$25.error("Failed to start bridge", { error });
|
|
82029
82044
|
throw error;
|
|
82030
82045
|
}
|
|
@@ -82111,12 +82126,10 @@ var BridgeManager = class {
|
|
|
82111
82126
|
* Close bridge connection
|
|
82112
82127
|
*/
|
|
82113
82128
|
async close() {
|
|
82114
|
-
if (this.bridgeProvider)
|
|
82115
|
-
await this.bridgeProvider.close();
|
|
82116
|
-
this.bridgeProvider = void 0;
|
|
82117
|
-
}
|
|
82129
|
+
if (this.bridgeProvider) await this.bridgeProvider.close();
|
|
82118
82130
|
this.eventQueue = [];
|
|
82119
82131
|
this.isProcessing = false;
|
|
82132
|
+
this.isActive = false;
|
|
82120
82133
|
this.isConnected = false;
|
|
82121
82134
|
this.reconnectAttempts = 0;
|
|
82122
82135
|
if (this.requestProcessingTimeoutId) {
|
|
@@ -82146,7 +82159,7 @@ var BridgeManager = class {
|
|
|
82146
82159
|
* Connect to TON Connect bridge
|
|
82147
82160
|
*/
|
|
82148
82161
|
async connectToSSEBridge() {
|
|
82149
|
-
if (!this.
|
|
82162
|
+
if (!this.bridgeProvider) throw new WalletKitError(ERROR_CODES.BRIDGE_NOT_INITIALIZED, "Bridge not initialized before connecting to SSE");
|
|
82150
82163
|
const connectTraceId = v7();
|
|
82151
82164
|
try {
|
|
82152
82165
|
const clients = await this.getClients();
|
|
@@ -82161,20 +82174,7 @@ var BridgeManager = class {
|
|
|
82161
82174
|
client_id: client?.clientId
|
|
82162
82175
|
});
|
|
82163
82176
|
}
|
|
82164
|
-
this.bridgeProvider
|
|
82165
|
-
bridgeUrl: this.config.bridgeUrl,
|
|
82166
|
-
clients,
|
|
82167
|
-
listener: this.queueBridgeEvent.bind(this),
|
|
82168
|
-
errorListener: (error) => {
|
|
82169
|
-
log$25.error("Bridge listener error", { error: error.toString() });
|
|
82170
|
-
this.analytics?.emitBridgeClientConnectError({
|
|
82171
|
-
error_message: `${error?.toString() || "Unknown error"}${error?.errorCode ? ` (Code: ${error?.errorCode})` : ""}`,
|
|
82172
|
-
trace_id: error?.traceId ?? connectTraceId,
|
|
82173
|
-
client_id: error?.clientId
|
|
82174
|
-
});
|
|
82175
|
-
},
|
|
82176
|
-
options: { lastEventId: this.lastEventId }
|
|
82177
|
-
});
|
|
82177
|
+
await this.bridgeProvider?.restoreConnection(clients, { lastEventId: this.lastEventId });
|
|
82178
82178
|
this.isConnected = true;
|
|
82179
82179
|
this.reconnectAttempts = 0;
|
|
82180
82180
|
log$25.info("Bridge connected successfully");
|
package/dist/index.js
CHANGED
|
@@ -81980,6 +81980,7 @@ var BridgeManager = class {
|
|
|
81980
81980
|
jsBridgeTransport;
|
|
81981
81981
|
eventQueue = [];
|
|
81982
81982
|
isProcessing = false;
|
|
81983
|
+
isActive = false;
|
|
81983
81984
|
eventStore;
|
|
81984
81985
|
eventRouter;
|
|
81985
81986
|
eventEmitter;
|
|
@@ -82003,14 +82004,27 @@ var BridgeManager = class {
|
|
|
82003
82004
|
this.analytics = analyticsManager?.scoped({ bridge_url: this.config.bridgeUrl });
|
|
82004
82005
|
this.walletKitConfig = walletKitConfig;
|
|
82005
82006
|
this.jsBridgeTransport = config?.jsBridgeTransport;
|
|
82007
|
+
if (this.config.bridgeUrl && !this.config.disableHttpConnection) this.bridgeProvider = new C$1(this.config.bridgeUrl, this.queueBridgeEvent.bind(this), (error) => {
|
|
82008
|
+
log$25.error("Bridge listener error", { error: error.toString() });
|
|
82009
|
+
this.analytics?.emitBridgeClientConnectError({
|
|
82010
|
+
error_message: `${error?.toString() || "Unknown error"}${error?.errorCode ? ` (Code: ${error?.errorCode})` : ""}`,
|
|
82011
|
+
trace_id: error?.traceId,
|
|
82012
|
+
client_id: error?.clientId
|
|
82013
|
+
});
|
|
82014
|
+
});
|
|
82006
82015
|
if (!this.jsBridgeTransport && config?.enableJsBridge) throw new WalletKitError(ERROR_CODES.INVALID_CONFIG, "JS Bridge transport is not configured");
|
|
82007
82016
|
}
|
|
82008
82017
|
/**
|
|
82009
82018
|
* Initialize bridge connection
|
|
82010
82019
|
*/
|
|
82011
82020
|
async start() {
|
|
82012
|
-
if (this.
|
|
82013
|
-
log$25.warn("Bridge already
|
|
82021
|
+
if (this.isActive === true) {
|
|
82022
|
+
log$25.warn("Bridge already started");
|
|
82023
|
+
return;
|
|
82024
|
+
}
|
|
82025
|
+
this.isActive = true;
|
|
82026
|
+
if (this.isConnected === true) {
|
|
82027
|
+
log$25.warn("Bridge already connected");
|
|
82014
82028
|
return;
|
|
82015
82029
|
}
|
|
82016
82030
|
try {
|
|
@@ -82021,6 +82035,7 @@ var BridgeManager = class {
|
|
|
82021
82035
|
this.reconnectAttempts = 0;
|
|
82022
82036
|
}
|
|
82023
82037
|
} catch (error) {
|
|
82038
|
+
this.isActive = false;
|
|
82024
82039
|
log$25.error("Failed to start bridge", { error });
|
|
82025
82040
|
throw error;
|
|
82026
82041
|
}
|
|
@@ -82107,12 +82122,10 @@ var BridgeManager = class {
|
|
|
82107
82122
|
* Close bridge connection
|
|
82108
82123
|
*/
|
|
82109
82124
|
async close() {
|
|
82110
|
-
if (this.bridgeProvider)
|
|
82111
|
-
await this.bridgeProvider.close();
|
|
82112
|
-
this.bridgeProvider = void 0;
|
|
82113
|
-
}
|
|
82125
|
+
if (this.bridgeProvider) await this.bridgeProvider.close();
|
|
82114
82126
|
this.eventQueue = [];
|
|
82115
82127
|
this.isProcessing = false;
|
|
82128
|
+
this.isActive = false;
|
|
82116
82129
|
this.isConnected = false;
|
|
82117
82130
|
this.reconnectAttempts = 0;
|
|
82118
82131
|
if (this.requestProcessingTimeoutId) {
|
|
@@ -82142,7 +82155,7 @@ var BridgeManager = class {
|
|
|
82142
82155
|
* Connect to TON Connect bridge
|
|
82143
82156
|
*/
|
|
82144
82157
|
async connectToSSEBridge() {
|
|
82145
|
-
if (!this.
|
|
82158
|
+
if (!this.bridgeProvider) throw new WalletKitError(ERROR_CODES.BRIDGE_NOT_INITIALIZED, "Bridge not initialized before connecting to SSE");
|
|
82146
82159
|
const connectTraceId = v7();
|
|
82147
82160
|
try {
|
|
82148
82161
|
const clients = await this.getClients();
|
|
@@ -82157,20 +82170,7 @@ var BridgeManager = class {
|
|
|
82157
82170
|
client_id: client?.clientId
|
|
82158
82171
|
});
|
|
82159
82172
|
}
|
|
82160
|
-
this.bridgeProvider
|
|
82161
|
-
bridgeUrl: this.config.bridgeUrl,
|
|
82162
|
-
clients,
|
|
82163
|
-
listener: this.queueBridgeEvent.bind(this),
|
|
82164
|
-
errorListener: (error) => {
|
|
82165
|
-
log$25.error("Bridge listener error", { error: error.toString() });
|
|
82166
|
-
this.analytics?.emitBridgeClientConnectError({
|
|
82167
|
-
error_message: `${error?.toString() || "Unknown error"}${error?.errorCode ? ` (Code: ${error?.errorCode})` : ""}`,
|
|
82168
|
-
trace_id: error?.traceId ?? connectTraceId,
|
|
82169
|
-
client_id: error?.clientId
|
|
82170
|
-
});
|
|
82171
|
-
},
|
|
82172
|
-
options: { lastEventId: this.lastEventId }
|
|
82173
|
-
});
|
|
82173
|
+
await this.bridgeProvider?.restoreConnection(clients, { lastEventId: this.lastEventId });
|
|
82174
82174
|
this.isConnected = true;
|
|
82175
82175
|
this.reconnectAttempts = 0;
|
|
82176
82176
|
log$25.info("Bridge connected successfully");
|
package/dist/serverless.cjs
CHANGED
|
@@ -70014,6 +70014,7 @@ var BridgeManager = class {
|
|
|
70014
70014
|
jsBridgeTransport;
|
|
70015
70015
|
eventQueue = [];
|
|
70016
70016
|
isProcessing = false;
|
|
70017
|
+
isActive = false;
|
|
70017
70018
|
eventStore;
|
|
70018
70019
|
eventRouter;
|
|
70019
70020
|
eventEmitter;
|
|
@@ -70037,14 +70038,27 @@ var BridgeManager = class {
|
|
|
70037
70038
|
this.analytics = analyticsManager?.scoped({ bridge_url: this.config.bridgeUrl });
|
|
70038
70039
|
this.walletKitConfig = walletKitConfig;
|
|
70039
70040
|
this.jsBridgeTransport = config?.jsBridgeTransport;
|
|
70041
|
+
if (this.config.bridgeUrl && !this.config.disableHttpConnection) this.bridgeProvider = new C$1(this.config.bridgeUrl, this.queueBridgeEvent.bind(this), (error) => {
|
|
70042
|
+
log$25.error("Bridge listener error", { error: error.toString() });
|
|
70043
|
+
this.analytics?.emitBridgeClientConnectError({
|
|
70044
|
+
error_message: `${error?.toString() || "Unknown error"}${error?.errorCode ? ` (Code: ${error?.errorCode})` : ""}`,
|
|
70045
|
+
trace_id: error?.traceId,
|
|
70046
|
+
client_id: error?.clientId
|
|
70047
|
+
});
|
|
70048
|
+
});
|
|
70040
70049
|
if (!this.jsBridgeTransport && config?.enableJsBridge) throw new WalletKitError(ERROR_CODES.INVALID_CONFIG, "JS Bridge transport is not configured");
|
|
70041
70050
|
}
|
|
70042
70051
|
/**
|
|
70043
70052
|
* Initialize bridge connection
|
|
70044
70053
|
*/
|
|
70045
70054
|
async start() {
|
|
70046
|
-
if (this.
|
|
70047
|
-
log$25.warn("Bridge already
|
|
70055
|
+
if (this.isActive === true) {
|
|
70056
|
+
log$25.warn("Bridge already started");
|
|
70057
|
+
return;
|
|
70058
|
+
}
|
|
70059
|
+
this.isActive = true;
|
|
70060
|
+
if (this.isConnected === true) {
|
|
70061
|
+
log$25.warn("Bridge already connected");
|
|
70048
70062
|
return;
|
|
70049
70063
|
}
|
|
70050
70064
|
try {
|
|
@@ -70055,6 +70069,7 @@ var BridgeManager = class {
|
|
|
70055
70069
|
this.reconnectAttempts = 0;
|
|
70056
70070
|
}
|
|
70057
70071
|
} catch (error) {
|
|
70072
|
+
this.isActive = false;
|
|
70058
70073
|
log$25.error("Failed to start bridge", { error });
|
|
70059
70074
|
throw error;
|
|
70060
70075
|
}
|
|
@@ -70141,12 +70156,10 @@ var BridgeManager = class {
|
|
|
70141
70156
|
* Close bridge connection
|
|
70142
70157
|
*/
|
|
70143
70158
|
async close() {
|
|
70144
|
-
if (this.bridgeProvider)
|
|
70145
|
-
await this.bridgeProvider.close();
|
|
70146
|
-
this.bridgeProvider = void 0;
|
|
70147
|
-
}
|
|
70159
|
+
if (this.bridgeProvider) await this.bridgeProvider.close();
|
|
70148
70160
|
this.eventQueue = [];
|
|
70149
70161
|
this.isProcessing = false;
|
|
70162
|
+
this.isActive = false;
|
|
70150
70163
|
this.isConnected = false;
|
|
70151
70164
|
this.reconnectAttempts = 0;
|
|
70152
70165
|
if (this.requestProcessingTimeoutId) {
|
|
@@ -70176,7 +70189,7 @@ var BridgeManager = class {
|
|
|
70176
70189
|
* Connect to TON Connect bridge
|
|
70177
70190
|
*/
|
|
70178
70191
|
async connectToSSEBridge() {
|
|
70179
|
-
if (!this.
|
|
70192
|
+
if (!this.bridgeProvider) throw new WalletKitError(ERROR_CODES.BRIDGE_NOT_INITIALIZED, "Bridge not initialized before connecting to SSE");
|
|
70180
70193
|
const connectTraceId = v7();
|
|
70181
70194
|
try {
|
|
70182
70195
|
const clients = await this.getClients();
|
|
@@ -70191,20 +70204,7 @@ var BridgeManager = class {
|
|
|
70191
70204
|
client_id: client?.clientId
|
|
70192
70205
|
});
|
|
70193
70206
|
}
|
|
70194
|
-
this.bridgeProvider
|
|
70195
|
-
bridgeUrl: this.config.bridgeUrl,
|
|
70196
|
-
clients,
|
|
70197
|
-
listener: this.queueBridgeEvent.bind(this),
|
|
70198
|
-
errorListener: (error) => {
|
|
70199
|
-
log$25.error("Bridge listener error", { error: error.toString() });
|
|
70200
|
-
this.analytics?.emitBridgeClientConnectError({
|
|
70201
|
-
error_message: `${error?.toString() || "Unknown error"}${error?.errorCode ? ` (Code: ${error?.errorCode})` : ""}`,
|
|
70202
|
-
trace_id: error?.traceId ?? connectTraceId,
|
|
70203
|
-
client_id: error?.clientId
|
|
70204
|
-
});
|
|
70205
|
-
},
|
|
70206
|
-
options: { lastEventId: this.lastEventId }
|
|
70207
|
-
});
|
|
70207
|
+
await this.bridgeProvider?.restoreConnection(clients, { lastEventId: this.lastEventId });
|
|
70208
70208
|
this.isConnected = true;
|
|
70209
70209
|
this.reconnectAttempts = 0;
|
|
70210
70210
|
log$25.info("Bridge connected successfully");
|
package/dist/serverless.js
CHANGED
|
@@ -70010,6 +70010,7 @@ var BridgeManager = class {
|
|
|
70010
70010
|
jsBridgeTransport;
|
|
70011
70011
|
eventQueue = [];
|
|
70012
70012
|
isProcessing = false;
|
|
70013
|
+
isActive = false;
|
|
70013
70014
|
eventStore;
|
|
70014
70015
|
eventRouter;
|
|
70015
70016
|
eventEmitter;
|
|
@@ -70033,14 +70034,27 @@ var BridgeManager = class {
|
|
|
70033
70034
|
this.analytics = analyticsManager?.scoped({ bridge_url: this.config.bridgeUrl });
|
|
70034
70035
|
this.walletKitConfig = walletKitConfig;
|
|
70035
70036
|
this.jsBridgeTransport = config?.jsBridgeTransport;
|
|
70037
|
+
if (this.config.bridgeUrl && !this.config.disableHttpConnection) this.bridgeProvider = new C$1(this.config.bridgeUrl, this.queueBridgeEvent.bind(this), (error) => {
|
|
70038
|
+
log$25.error("Bridge listener error", { error: error.toString() });
|
|
70039
|
+
this.analytics?.emitBridgeClientConnectError({
|
|
70040
|
+
error_message: `${error?.toString() || "Unknown error"}${error?.errorCode ? ` (Code: ${error?.errorCode})` : ""}`,
|
|
70041
|
+
trace_id: error?.traceId,
|
|
70042
|
+
client_id: error?.clientId
|
|
70043
|
+
});
|
|
70044
|
+
});
|
|
70036
70045
|
if (!this.jsBridgeTransport && config?.enableJsBridge) throw new WalletKitError(ERROR_CODES.INVALID_CONFIG, "JS Bridge transport is not configured");
|
|
70037
70046
|
}
|
|
70038
70047
|
/**
|
|
70039
70048
|
* Initialize bridge connection
|
|
70040
70049
|
*/
|
|
70041
70050
|
async start() {
|
|
70042
|
-
if (this.
|
|
70043
|
-
log$25.warn("Bridge already
|
|
70051
|
+
if (this.isActive === true) {
|
|
70052
|
+
log$25.warn("Bridge already started");
|
|
70053
|
+
return;
|
|
70054
|
+
}
|
|
70055
|
+
this.isActive = true;
|
|
70056
|
+
if (this.isConnected === true) {
|
|
70057
|
+
log$25.warn("Bridge already connected");
|
|
70044
70058
|
return;
|
|
70045
70059
|
}
|
|
70046
70060
|
try {
|
|
@@ -70051,6 +70065,7 @@ var BridgeManager = class {
|
|
|
70051
70065
|
this.reconnectAttempts = 0;
|
|
70052
70066
|
}
|
|
70053
70067
|
} catch (error) {
|
|
70068
|
+
this.isActive = false;
|
|
70054
70069
|
log$25.error("Failed to start bridge", { error });
|
|
70055
70070
|
throw error;
|
|
70056
70071
|
}
|
|
@@ -70137,12 +70152,10 @@ var BridgeManager = class {
|
|
|
70137
70152
|
* Close bridge connection
|
|
70138
70153
|
*/
|
|
70139
70154
|
async close() {
|
|
70140
|
-
if (this.bridgeProvider)
|
|
70141
|
-
await this.bridgeProvider.close();
|
|
70142
|
-
this.bridgeProvider = void 0;
|
|
70143
|
-
}
|
|
70155
|
+
if (this.bridgeProvider) await this.bridgeProvider.close();
|
|
70144
70156
|
this.eventQueue = [];
|
|
70145
70157
|
this.isProcessing = false;
|
|
70158
|
+
this.isActive = false;
|
|
70146
70159
|
this.isConnected = false;
|
|
70147
70160
|
this.reconnectAttempts = 0;
|
|
70148
70161
|
if (this.requestProcessingTimeoutId) {
|
|
@@ -70172,7 +70185,7 @@ var BridgeManager = class {
|
|
|
70172
70185
|
* Connect to TON Connect bridge
|
|
70173
70186
|
*/
|
|
70174
70187
|
async connectToSSEBridge() {
|
|
70175
|
-
if (!this.
|
|
70188
|
+
if (!this.bridgeProvider) throw new WalletKitError(ERROR_CODES.BRIDGE_NOT_INITIALIZED, "Bridge not initialized before connecting to SSE");
|
|
70176
70189
|
const connectTraceId = v7();
|
|
70177
70190
|
try {
|
|
70178
70191
|
const clients = await this.getClients();
|
|
@@ -70187,20 +70200,7 @@ var BridgeManager = class {
|
|
|
70187
70200
|
client_id: client?.clientId
|
|
70188
70201
|
});
|
|
70189
70202
|
}
|
|
70190
|
-
this.bridgeProvider
|
|
70191
|
-
bridgeUrl: this.config.bridgeUrl,
|
|
70192
|
-
clients,
|
|
70193
|
-
listener: this.queueBridgeEvent.bind(this),
|
|
70194
|
-
errorListener: (error) => {
|
|
70195
|
-
log$25.error("Bridge listener error", { error: error.toString() });
|
|
70196
|
-
this.analytics?.emitBridgeClientConnectError({
|
|
70197
|
-
error_message: `${error?.toString() || "Unknown error"}${error?.errorCode ? ` (Code: ${error?.errorCode})` : ""}`,
|
|
70198
|
-
trace_id: error?.traceId ?? connectTraceId,
|
|
70199
|
-
client_id: error?.clientId
|
|
70200
|
-
});
|
|
70201
|
-
},
|
|
70202
|
-
options: { lastEventId: this.lastEventId }
|
|
70203
|
-
});
|
|
70203
|
+
await this.bridgeProvider?.restoreConnection(clients, { lastEventId: this.lastEventId });
|
|
70204
70204
|
this.isConnected = true;
|
|
70205
70205
|
this.reconnectAttempts = 0;
|
|
70206
70206
|
log$25.info("Bridge connected successfully");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ton/mcp",
|
|
3
|
-
"version": "0.1.15-alpha.
|
|
3
|
+
"version": "0.1.15-alpha.15",
|
|
4
4
|
"description": "TON MCP Server - Model Context Protocol server for TON blockchain wallet operations",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"undici": "8.0.2",
|
|
61
61
|
"ws": "^8.20.0",
|
|
62
62
|
"zod": "^3.25.76",
|
|
63
|
-
"@ton/walletkit": "0.0.12-alpha.
|
|
63
|
+
"@ton/walletkit": "0.0.12-alpha.3"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@modelcontextprotocol/sdk": "^1.25.1"
|