bruce-models 7.1.107 → 7.1.108
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/bruce-models.es5.js +71 -6
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +71 -6
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/mcp/navigator-mcp-websocket.js +70 -5
- package/dist/lib/mcp/navigator-mcp-websocket.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/mcp/navigator-mcp-websocket.d.ts +6 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -19191,6 +19191,8 @@ class NavigatorMcpWebSocketClient {
|
|
|
19191
19191
|
constructor(toolHandler, options = {}) {
|
|
19192
19192
|
this.ws = null;
|
|
19193
19193
|
this.isConnecting = false;
|
|
19194
|
+
this.responseGeneration = 0;
|
|
19195
|
+
this.pendingResponses = [];
|
|
19194
19196
|
this.toolHandler = toolHandler;
|
|
19195
19197
|
this.options = options;
|
|
19196
19198
|
this.currentAuth = options.auth;
|
|
@@ -19201,7 +19203,7 @@ class NavigatorMcpWebSocketClient {
|
|
|
19201
19203
|
connect(auth) {
|
|
19202
19204
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
19203
19205
|
if (auth) {
|
|
19204
|
-
this.
|
|
19206
|
+
this.setAuth(auth);
|
|
19205
19207
|
}
|
|
19206
19208
|
if (this.isConnecting || ((_a = this.ws) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.OPEN) {
|
|
19207
19209
|
(_c = (_b = this.logger()).debug) === null || _c === void 0 ? void 0 : _c.call(_b, "[NavigatorMcpWS] Connection already active or in-flight; skipping connect.");
|
|
@@ -19212,24 +19214,34 @@ class NavigatorMcpWebSocketClient {
|
|
|
19212
19214
|
const url = this.buildUrl();
|
|
19213
19215
|
(_e = (_d = this.logger()).log) === null || _e === void 0 ? void 0 : _e.call(_d, "[NavigatorMcpWS] Connecting to", url);
|
|
19214
19216
|
this.ws = new WebSocket(url);
|
|
19217
|
+
const socket = this.ws;
|
|
19215
19218
|
this.ws.onopen = (event) => {
|
|
19216
19219
|
var _a, _b, _c, _d;
|
|
19220
|
+
if (this.ws !== socket)
|
|
19221
|
+
return;
|
|
19217
19222
|
(_b = (_a = this.logger()).log) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Connected");
|
|
19218
19223
|
this.isConnecting = false;
|
|
19219
19224
|
this.send({ method: "server_ready" });
|
|
19225
|
+
this.flushResponses();
|
|
19220
19226
|
(_d = (_c = this.options).onOpen) === null || _d === void 0 ? void 0 : _d.call(_c, event);
|
|
19221
19227
|
};
|
|
19222
19228
|
this.ws.onmessage = (event) => {
|
|
19229
|
+
if (this.ws !== socket)
|
|
19230
|
+
return;
|
|
19223
19231
|
this.handleMessage(event.data);
|
|
19224
19232
|
};
|
|
19225
19233
|
this.ws.onerror = (event) => {
|
|
19226
19234
|
var _a, _b, _c, _d;
|
|
19235
|
+
if (this.ws !== socket)
|
|
19236
|
+
return;
|
|
19227
19237
|
(_b = (_a = this.logger()).error) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Error", event);
|
|
19228
19238
|
(_d = (_c = this.options).onError) === null || _d === void 0 ? void 0 : _d.call(_c, event);
|
|
19229
19239
|
this.isConnecting = false;
|
|
19230
19240
|
};
|
|
19231
19241
|
this.ws.onclose = (event) => {
|
|
19232
19242
|
var _a, _b, _c, _d;
|
|
19243
|
+
if (this.ws !== socket)
|
|
19244
|
+
return;
|
|
19233
19245
|
(_b = (_a = this.logger()).log) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Disconnected");
|
|
19234
19246
|
this.ws = null;
|
|
19235
19247
|
this.isConnecting = false;
|
|
@@ -19243,6 +19255,9 @@ class NavigatorMcpWebSocketClient {
|
|
|
19243
19255
|
}
|
|
19244
19256
|
disconnect() {
|
|
19245
19257
|
var _a, _b;
|
|
19258
|
+
// An explicit disconnect ends the logical session; never replay its results.
|
|
19259
|
+
this.responseGeneration++;
|
|
19260
|
+
this.pendingResponses = [];
|
|
19246
19261
|
if (this.ws) {
|
|
19247
19262
|
(_b = (_a = this.logger()).debug) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Closing connection");
|
|
19248
19263
|
this.ws.close();
|
|
@@ -19259,6 +19274,16 @@ class NavigatorMcpWebSocketClient {
|
|
|
19259
19274
|
* Call connect() afterwards to establish a connection with the new auth.
|
|
19260
19275
|
*/
|
|
19261
19276
|
setAuth(auth) {
|
|
19277
|
+
const key = (value) => JSON.stringify([
|
|
19278
|
+
value === null || value === void 0 ? void 0 : value.accountId,
|
|
19279
|
+
value === null || value === void 0 ? void 0 : value.sessionId,
|
|
19280
|
+
value === null || value === void 0 ? void 0 : value.fingerprint,
|
|
19281
|
+
value === null || value === void 0 ? void 0 : value.apiBaseUrl
|
|
19282
|
+
]);
|
|
19283
|
+
if (key(auth) !== key(this.currentAuth)) {
|
|
19284
|
+
this.responseGeneration++;
|
|
19285
|
+
this.pendingResponses = [];
|
|
19286
|
+
}
|
|
19262
19287
|
this.currentAuth = auth;
|
|
19263
19288
|
}
|
|
19264
19289
|
sendChatEvent(event) {
|
|
@@ -19303,7 +19328,7 @@ class NavigatorMcpWebSocketClient {
|
|
|
19303
19328
|
return urlInstance.toString();
|
|
19304
19329
|
}
|
|
19305
19330
|
handleMessage(raw) {
|
|
19306
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
19331
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
19307
19332
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19308
19333
|
try {
|
|
19309
19334
|
const message = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
@@ -19325,6 +19350,7 @@ class NavigatorMcpWebSocketClient {
|
|
|
19325
19350
|
return;
|
|
19326
19351
|
}
|
|
19327
19352
|
let result;
|
|
19353
|
+
const generation = this.responseGeneration;
|
|
19328
19354
|
try {
|
|
19329
19355
|
result = yield this.toolHandler({
|
|
19330
19356
|
name: toolName,
|
|
@@ -19336,23 +19362,62 @@ class NavigatorMcpWebSocketClient {
|
|
|
19336
19362
|
(_l = (_k = this.logger()).error) === null || _l === void 0 ? void 0 : _l.call(_k, "[NavigatorMcpWS] Tool handler threw", error);
|
|
19337
19363
|
result = `Error: ${error instanceof Error ? error.message : String(error)}`;
|
|
19338
19364
|
}
|
|
19339
|
-
this.
|
|
19365
|
+
if (generation !== this.responseGeneration) {
|
|
19366
|
+
(_o = (_m = this.logger()).warn) === null || _o === void 0 ? void 0 : _o.call(_m, "[NavigatorMcpWS] Discarding result from a previous session", messageId);
|
|
19367
|
+
return;
|
|
19368
|
+
}
|
|
19369
|
+
this.sendResponse({
|
|
19340
19370
|
method: "tool_response",
|
|
19341
19371
|
id: messageId,
|
|
19342
19372
|
result
|
|
19343
19373
|
});
|
|
19344
19374
|
}
|
|
19345
19375
|
catch (error) {
|
|
19346
|
-
(
|
|
19376
|
+
(_q = (_p = this.logger()).error) === null || _q === void 0 ? void 0 : _q.call(_p, "[NavigatorMcpWS] Invalid message", error);
|
|
19347
19377
|
}
|
|
19348
19378
|
});
|
|
19349
19379
|
}
|
|
19380
|
+
sendResponse(message) {
|
|
19381
|
+
var _a, _b, _c, _d, _e;
|
|
19382
|
+
if (this.send(message))
|
|
19383
|
+
return;
|
|
19384
|
+
this.pendingResponses = this.pendingResponses.filter((entry) => entry.expiresAt > Date.now());
|
|
19385
|
+
if (this.pendingResponses.length >= NavigatorMcpWebSocketClient.MAX_PENDING_RESPONSES) {
|
|
19386
|
+
const dropped = this.pendingResponses.shift();
|
|
19387
|
+
(_b = (_a = this.logger()).warn) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Response queue full; dropping oldest result", (_c = dropped === null || dropped === void 0 ? void 0 : dropped.message) === null || _c === void 0 ? void 0 : _c.id);
|
|
19388
|
+
}
|
|
19389
|
+
this.pendingResponses.push({ message, expiresAt: Date.now() + NavigatorMcpWebSocketClient.RESPONSE_TTL_MS });
|
|
19390
|
+
(_e = (_d = this.logger()).warn) === null || _e === void 0 ? void 0 : _e.call(_d, "[NavigatorMcpWS] Tool result queued until reconnect", message.id);
|
|
19391
|
+
}
|
|
19392
|
+
flushResponses() {
|
|
19393
|
+
var _a, _b;
|
|
19394
|
+
const pending = this.pendingResponses;
|
|
19395
|
+
this.pendingResponses = [];
|
|
19396
|
+
for (const entry of pending) {
|
|
19397
|
+
if (entry.expiresAt <= Date.now()) {
|
|
19398
|
+
(_b = (_a = this.logger()).warn) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Tool result expired before reconnect", entry.message.id);
|
|
19399
|
+
}
|
|
19400
|
+
else if (!this.send(entry.message)) {
|
|
19401
|
+
this.pendingResponses.push(entry);
|
|
19402
|
+
}
|
|
19403
|
+
}
|
|
19404
|
+
}
|
|
19350
19405
|
send(message) {
|
|
19351
|
-
|
|
19406
|
+
var _a, _b;
|
|
19407
|
+
if (!this.ws || this.ws.readyState !== WebSocket.OPEN)
|
|
19408
|
+
return false;
|
|
19409
|
+
try {
|
|
19352
19410
|
this.ws.send(JSON.stringify(message));
|
|
19411
|
+
return true;
|
|
19412
|
+
}
|
|
19413
|
+
catch (error) {
|
|
19414
|
+
(_b = (_a = this.logger()).error) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Send failed", error);
|
|
19415
|
+
return false;
|
|
19353
19416
|
}
|
|
19354
19417
|
}
|
|
19355
19418
|
}
|
|
19419
|
+
NavigatorMcpWebSocketClient.RESPONSE_TTL_MS = 60000;
|
|
19420
|
+
NavigatorMcpWebSocketClient.MAX_PENDING_RESPONSES = 32;
|
|
19356
19421
|
|
|
19357
19422
|
var Plugin;
|
|
19358
19423
|
(function (Plugin) {
|
|
@@ -24746,7 +24811,7 @@ function getFirstWrappedArray(data, wrapperKeys) {
|
|
|
24746
24811
|
}
|
|
24747
24812
|
|
|
24748
24813
|
// This is updated with the package.json version on build.
|
|
24749
|
-
const VERSION = "7.1.
|
|
24814
|
+
const VERSION = "7.1.108";
|
|
24750
24815
|
|
|
24751
24816
|
export { VERSION, Account, AccountAudit, AccountConcept, AccountFeatures, AccountInvite, AccountLimits, AccountTemplate, AccountType, AnnDocument, AbstractApi, Api, ApiGetters, BruceApi, GlobalApi, GuardianApi, Assembly, Calculator, ChangeSet, ClientFile, ClientFileValueMap, Bounds, BruceEvent, BruceVariable, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, RequestLane, GeoJson, Geometry, LRUCache, UTC, CustomForm, DashboardView, DataFeed, DataLab, DataLabGroup, DataSource, DataTransform, Comment, Entity, EntityAttachment, EntityAttachmentType, EntityAttribute, EntityComment, EntityCoords, EntityHistoricData, EntityLink, EntityLod, EntityLodCategory, EntityRelation, EntityRelationType, EntitySource, EntityTableView, EntityTag, EntityType, EntityTypeRelation, EntityTypeTrigger, Ontology, OntologyDocument, ENVIRONMENT, ExportBrz, ExportCsv, ExportNsx, ExportUsd, Hexbin, ImportAssembly, ImportCad, ImportCsv, ImportGeoJson, ImportJson, ImportKml, ImportLcc, ImportTif, ImportedFile, Uploader, Markup, UIMarkup, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, Plugin, PluginAiTool, ProgramKey, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewBookmarkGroup, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewLegacyTile, ProjectViewTile, ZoomControl, Scenario, HostingLocation, MessageBroker, PendingAction, RecordChangeFeed, Style, Tileset, Tracking, Permission, Session, User, UserGroup, UserMfaMethod, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, WorkflowItem, WorkflowSchedule, WorkflowType, WorkflowItemType };
|
|
24752
24817
|
//# sourceMappingURL=bruce-models.es5.js.map
|