@abraca/mcp 1.1.1 → 1.3.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.
|
@@ -19448,6 +19448,7 @@ var AbracadabraMCPServer = class {
|
|
|
19448
19448
|
this._statusClearTimer = null;
|
|
19449
19449
|
this._typingInterval = null;
|
|
19450
19450
|
this._lastChatChannel = null;
|
|
19451
|
+
this._signFn = null;
|
|
19451
19452
|
this.config = config;
|
|
19452
19453
|
this.client = new AbracadabraClient({
|
|
19453
19454
|
url: config.url,
|
|
@@ -19483,6 +19484,7 @@ var AbracadabraMCPServer = class {
|
|
|
19483
19484
|
const keypair = await loadOrCreateKeypair(this.config.keyFile);
|
|
19484
19485
|
this._userId = keypair.publicKeyB64;
|
|
19485
19486
|
const signFn = (challenge) => Promise.resolve(signChallenge(challenge, keypair.privateKey));
|
|
19487
|
+
this._signFn = signFn;
|
|
19486
19488
|
try {
|
|
19487
19489
|
await this.client.loginWithKey(keypair.publicKeyB64, signFn);
|
|
19488
19490
|
} catch (err) {
|
|
@@ -19543,6 +19545,11 @@ var AbracadabraMCPServer = class {
|
|
|
19543
19545
|
this._rootDocId = docId;
|
|
19544
19546
|
return existing;
|
|
19545
19547
|
}
|
|
19548
|
+
if (!this.client.isTokenValid() && this._signFn && this._userId) {
|
|
19549
|
+
console.error("[abracadabra-mcp] JWT expired, re-authenticating...");
|
|
19550
|
+
await this.client.loginWithKey(this._userId, this._signFn);
|
|
19551
|
+
console.error("[abracadabra-mcp] Re-authenticated successfully");
|
|
19552
|
+
}
|
|
19546
19553
|
const doc = new Y.Doc({ guid: docId });
|
|
19547
19554
|
const provider = new AbracadabraProvider({
|
|
19548
19555
|
name: docId,
|
|
@@ -19607,6 +19614,11 @@ var AbracadabraMCPServer = class {
|
|
|
19607
19614
|
}
|
|
19608
19615
|
const activeProvider = this._activeConnection?.provider;
|
|
19609
19616
|
if (!activeProvider) throw new Error("Not connected. Call connect() first.");
|
|
19617
|
+
if (!this.client.isTokenValid() && this._signFn && this._userId) {
|
|
19618
|
+
console.error("[abracadabra-mcp] JWT expired, re-authenticating...");
|
|
19619
|
+
await this.client.loginWithKey(this._userId, this._signFn);
|
|
19620
|
+
console.error("[abracadabra-mcp] Re-authenticated successfully");
|
|
19621
|
+
}
|
|
19610
19622
|
const childProvider = await activeProvider.loadChild(docId);
|
|
19611
19623
|
await waitForSync(childProvider);
|
|
19612
19624
|
childProvider.awareness.setLocalStateField("user", {
|