@icoretech/warden-mcp 0.2.5 → 0.2.6
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/bw/bwSession.js +18 -0
- package/package.json +1 -1
package/dist/bw/bwSession.js
CHANGED
|
@@ -170,6 +170,19 @@ export class BwSessionManager {
|
|
|
170
170
|
}).catch(() => { });
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
+
async currentServerUrl() {
|
|
174
|
+
try {
|
|
175
|
+
const { stdout } = await runBw(['status'], {
|
|
176
|
+
env: this.baseEnv(),
|
|
177
|
+
timeoutMs: 30_000,
|
|
178
|
+
});
|
|
179
|
+
const parsed = JSON.parse(stdout);
|
|
180
|
+
return typeof parsed.serverUrl === 'string' ? parsed.serverUrl : null;
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
173
186
|
async ensureUnlockedInternal() {
|
|
174
187
|
// Ensure server config points to BW_HOST.
|
|
175
188
|
await this.ensureServerConfigured();
|
|
@@ -271,6 +284,11 @@ export class BwSessionManager {
|
|
|
271
284
|
async ensureServerConfigured() {
|
|
272
285
|
if (this.configuredHost === this.env.host)
|
|
273
286
|
return;
|
|
287
|
+
const currentHost = await this.currentServerUrl();
|
|
288
|
+
if (currentHost === this.env.host) {
|
|
289
|
+
this.configuredHost = currentHost;
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
274
292
|
// bw requires logout before config server update.
|
|
275
293
|
await runBw(['logout'], { env: this.baseEnv(), timeoutMs: 30_000 }).catch(() => { });
|
|
276
294
|
try {
|