bruce-models 6.9.0 → 6.9.1
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 +76 -5
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +76 -5
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/mcp/navigator-chat.js +75 -4
- package/dist/lib/mcp/navigator-chat.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/mcp/navigator-chat.d.ts +7 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -16470,6 +16470,8 @@ var Tracking;
|
|
|
16470
16470
|
Tracking.GetData = GetData;
|
|
16471
16471
|
})(Tracking || (Tracking = {}));
|
|
16472
16472
|
|
|
16473
|
+
const JOB_POLL_INTERVAL_MS = 1000;
|
|
16474
|
+
const JOB_POLL_TIMEOUT_MS = 4 * 60 * 1000; // match server timeout (4 minutes)
|
|
16473
16475
|
const DEFAULT_BASE_URL = "http://localhost:8888";
|
|
16474
16476
|
/**
|
|
16475
16477
|
* Lightweight client for the Navigator MCP chat HTTP endpoints.
|
|
@@ -16504,11 +16506,13 @@ class NavigatorChatClient {
|
|
|
16504
16506
|
}
|
|
16505
16507
|
}, auth);
|
|
16506
16508
|
const data = yield this.parseJson(response);
|
|
16509
|
+
// New async job flow (HTTP 202)
|
|
16510
|
+
if (data && data.jobId && data.status && response.status === 202) {
|
|
16511
|
+
return yield this.waitForJobCompletion(data, auth);
|
|
16512
|
+
}
|
|
16513
|
+
// Legacy synchronous flow fallback
|
|
16507
16514
|
const text = (_b = (_a = data === null || data === void 0 ? void 0 : data.Text) !== null && _a !== void 0 ? _a : data === null || data === void 0 ? void 0 : data.text) !== null && _b !== void 0 ? _b : "";
|
|
16508
|
-
const
|
|
16509
|
-
const steps = rawSteps
|
|
16510
|
-
.filter((step) => step)
|
|
16511
|
-
.map((step, idx) => (Object.assign(Object.assign({}, step), { index: typeof (step === null || step === void 0 ? void 0 : step.index) === "number" ? step.index : idx })));
|
|
16515
|
+
const steps = this.normalizeSteps(data === null || data === void 0 ? void 0 : data.steps);
|
|
16512
16516
|
return {
|
|
16513
16517
|
text,
|
|
16514
16518
|
steps,
|
|
@@ -16539,6 +16543,73 @@ class NavigatorChatClient {
|
|
|
16539
16543
|
// Use URL constructor to properly handle path joining and avoid double slashes
|
|
16540
16544
|
return new URL(path, this.baseUrl).toString();
|
|
16541
16545
|
}
|
|
16546
|
+
normalizeSteps(rawSteps) {
|
|
16547
|
+
if (!Array.isArray(rawSteps)) {
|
|
16548
|
+
return [];
|
|
16549
|
+
}
|
|
16550
|
+
return rawSteps
|
|
16551
|
+
.filter((step) => Boolean(step))
|
|
16552
|
+
.map((step, idx) => (Object.assign(Object.assign({}, step), { index: typeof (step === null || step === void 0 ? void 0 : step.index) === "number" ? step.index : idx })));
|
|
16553
|
+
}
|
|
16554
|
+
waitForJobCompletion(envelope, auth) {
|
|
16555
|
+
var _a, _b, _c, _d, _e;
|
|
16556
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16557
|
+
if (!envelope.jobId) {
|
|
16558
|
+
throw new Error("Chat job response did not include a jobId.");
|
|
16559
|
+
}
|
|
16560
|
+
const pollPath = (_a = envelope.pollUrl) !== null && _a !== void 0 ? _a : `/chat/jobs/${envelope.jobId}`;
|
|
16561
|
+
const startedAt = Date.now();
|
|
16562
|
+
while (Date.now() - startedAt < JOB_POLL_TIMEOUT_MS) {
|
|
16563
|
+
const statusPayload = yield this.fetchJobStatus(pollPath, auth);
|
|
16564
|
+
const status = statusPayload === null || statusPayload === void 0 ? void 0 : statusPayload.status;
|
|
16565
|
+
if (!status) {
|
|
16566
|
+
yield this.delay(JOB_POLL_INTERVAL_MS);
|
|
16567
|
+
continue;
|
|
16568
|
+
}
|
|
16569
|
+
const combinedSteps = [
|
|
16570
|
+
...(Array.isArray(statusPayload.steps) ? statusPayload.steps : []),
|
|
16571
|
+
...(Array.isArray((_b = statusPayload.result) === null || _b === void 0 ? void 0 : _b.steps) ? statusPayload.result.steps : [])
|
|
16572
|
+
];
|
|
16573
|
+
const normalizedSteps = this.normalizeSteps(combinedSteps);
|
|
16574
|
+
if (status === "COMPLETED") {
|
|
16575
|
+
const result = (_c = statusPayload.result) !== null && _c !== void 0 ? _c : {};
|
|
16576
|
+
const text = (_d = result === null || result === void 0 ? void 0 : result.text) !== null && _d !== void 0 ? _d : "";
|
|
16577
|
+
return {
|
|
16578
|
+
text,
|
|
16579
|
+
steps: normalizedSteps,
|
|
16580
|
+
raw: statusPayload,
|
|
16581
|
+
jobId: envelope.jobId,
|
|
16582
|
+
status,
|
|
16583
|
+
anonymous: Boolean((_e = result === null || result === void 0 ? void 0 : result.anonymous) !== null && _e !== void 0 ? _e : statusPayload.anonymous)
|
|
16584
|
+
};
|
|
16585
|
+
}
|
|
16586
|
+
if (status === "FAILED") {
|
|
16587
|
+
const message = statusPayload.error || "Chat job failed";
|
|
16588
|
+
const error = message.trim() || "Chat job failed";
|
|
16589
|
+
throw new Error(error);
|
|
16590
|
+
}
|
|
16591
|
+
yield this.delay(JOB_POLL_INTERVAL_MS);
|
|
16592
|
+
}
|
|
16593
|
+
throw new Error("Chat job polling timed out. Please try again later.");
|
|
16594
|
+
});
|
|
16595
|
+
}
|
|
16596
|
+
fetchJobStatus(path, auth) {
|
|
16597
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16598
|
+
const response = yield this.fetchFromEndpoint(path, {
|
|
16599
|
+
method: "GET"
|
|
16600
|
+
}, auth);
|
|
16601
|
+
const payload = yield this.parseJson(response);
|
|
16602
|
+
if (!payload || !payload.jobId) {
|
|
16603
|
+
throw new Error("Failed to retrieve chat job status.");
|
|
16604
|
+
}
|
|
16605
|
+
return payload;
|
|
16606
|
+
});
|
|
16607
|
+
}
|
|
16608
|
+
delay(ms) {
|
|
16609
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16610
|
+
yield new Promise(resolve => setTimeout(resolve, ms));
|
|
16611
|
+
});
|
|
16612
|
+
}
|
|
16542
16613
|
fetchFromEndpoint(path, init, auth) {
|
|
16543
16614
|
var _a;
|
|
16544
16615
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -16761,7 +16832,7 @@ class NavigatorMcpWebSocketClient {
|
|
|
16761
16832
|
}
|
|
16762
16833
|
|
|
16763
16834
|
// This is updated with the package.json version on build.
|
|
16764
|
-
const VERSION = "6.9.
|
|
16835
|
+
const VERSION = "6.9.1";
|
|
16765
16836
|
|
|
16766
16837
|
export { VERSION, Assembly, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, UserMfaMethod, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking, NavigatorChatClient, NavigatorMcpWebSocketClient };
|
|
16767
16838
|
//# sourceMappingURL=bruce-models.es5.js.map
|