@agentvault/agentvault 0.23.16 → 0.23.17
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/channel.d.ts +8 -0
- package/dist/channel.d.ts.map +1 -1
- package/dist/cli.js +27 -12
- package/dist/cli.js.map +2 -2
- package/dist/index.js +27 -12
- package/dist/index.js.map +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64122,13 +64122,21 @@ var init_channel = __esm({
|
|
|
64122
64122
|
* Non-fatal: a transient network error or 5xx keeps the current JWT and
|
|
64123
64123
|
* relies on the next reconnect. Terminal failures (401/403) surface via
|
|
64124
64124
|
* the `auth_failed` event so callers can prompt the user to recover.
|
|
64125
|
+
*
|
|
64126
|
+
* Returns TRUE when the credentials are terminally dead. #743: the caller
|
|
64127
|
+
* MUST NOT go on to open a WebSocket in that case — the server has already
|
|
64128
|
+
* told us this credential can never be served, and connecting anyway is what
|
|
64129
|
+
* produced `ws_guard action=denylist` on repeat in prod (device 0e87ff50, a
|
|
64130
|
+
* hard-deleted device, ~12/hour). The verdict is returned explicitly rather
|
|
64131
|
+
* than read back off `_authFailedThisSession`, whose lifetime is reset per
|
|
64132
|
+
* connect and is easy to get subtly wrong.
|
|
64125
64133
|
*/
|
|
64126
64134
|
async _maybeReissueDeviceJwt() {
|
|
64127
64135
|
const jwt2 = this._persisted?.deviceJwt ?? this._deviceJwt;
|
|
64128
|
-
if (!jwt2) return;
|
|
64136
|
+
if (!jwt2) return false;
|
|
64129
64137
|
const exp = this._decodeJwtExp(jwt2);
|
|
64130
64138
|
const nowSec = Math.floor(Date.now() / 1e3);
|
|
64131
|
-
if (exp - nowSec >= 30 * 86400) return;
|
|
64139
|
+
if (exp - nowSec >= 30 * 86400) return false;
|
|
64132
64140
|
try {
|
|
64133
64141
|
const resp = await fetch(`${this.config.apiUrl}/api/v1/auth/reissue`, {
|
|
64134
64142
|
method: "POST",
|
|
@@ -64148,7 +64156,7 @@ var init_channel = __esm({
|
|
|
64148
64156
|
} else {
|
|
64149
64157
|
console.warn("[SecureChannel] reissue returned 200 but no device_jwt in response");
|
|
64150
64158
|
}
|
|
64151
|
-
return;
|
|
64159
|
+
return false;
|
|
64152
64160
|
}
|
|
64153
64161
|
if (resp.status === 401 || resp.status === 403) {
|
|
64154
64162
|
console.warn(`[SecureChannel] reissue rejected (${resp.status}); credentials need attention`);
|
|
@@ -64156,12 +64164,13 @@ var init_channel = __esm({
|
|
|
64156
64164
|
const reason = resp.status === 401 ? "device_jwt_expired" : "device_revoked";
|
|
64157
64165
|
await this._postAuthFailedToBackend(reason);
|
|
64158
64166
|
this.emit("auth_failed", { reason });
|
|
64159
|
-
return;
|
|
64167
|
+
return true;
|
|
64160
64168
|
}
|
|
64161
64169
|
console.warn(`[SecureChannel] reissue ${resp.status}; keeping current jwt`);
|
|
64162
64170
|
} catch (err) {
|
|
64163
64171
|
console.warn("[SecureChannel] reissue network error; keeping current jwt:", err);
|
|
64164
64172
|
}
|
|
64173
|
+
return false;
|
|
64165
64174
|
}
|
|
64166
64175
|
/**
|
|
64167
64176
|
* Wraps `fetch` for authenticated AV REST endpoints with reactive device-JWT
|
|
@@ -64893,7 +64902,7 @@ var init_channel = __esm({
|
|
|
64893
64902
|
*/
|
|
64894
64903
|
sendActivitySpan(spanData) {
|
|
64895
64904
|
if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
|
|
64896
|
-
const pluginVersion = true ? "0.23.
|
|
64905
|
+
const pluginVersion = true ? "0.23.17" : "0.0.0-dev";
|
|
64897
64906
|
const agentName = this.config.agentName ?? "Agent";
|
|
64898
64907
|
const resource = {
|
|
64899
64908
|
"service.name": "agentvault-agent",
|
|
@@ -66711,7 +66720,13 @@ var init_channel = __esm({
|
|
|
66711
66720
|
this._ws = null;
|
|
66712
66721
|
}
|
|
66713
66722
|
this._setState("connecting");
|
|
66714
|
-
await this._maybeReissueDeviceJwt()
|
|
66723
|
+
if (await this._maybeReissueDeviceJwt()) {
|
|
66724
|
+
console.warn(
|
|
66725
|
+
"[SecureChannel] credentials are terminally dead \u2014 aborting connect (no WS attempt)"
|
|
66726
|
+
);
|
|
66727
|
+
this._setState("error");
|
|
66728
|
+
return;
|
|
66729
|
+
}
|
|
66715
66730
|
const wsUrl = this.config.apiUrl.replace(/^http/, "ws");
|
|
66716
66731
|
const url2 = `${wsUrl}/api/v1/ws?token=${encodeURIComponent(this._deviceJwt)}&device_id=${this._deviceId}`;
|
|
66717
66732
|
const ws = new WebSocket(url2);
|
|
@@ -66752,7 +66767,7 @@ var init_channel = __esm({
|
|
|
66752
66767
|
agentVersion: this.config.agentVersion ?? "0.0.0",
|
|
66753
66768
|
// __AV_VERSION__ is injected by esbuild from package.json at build time.
|
|
66754
66769
|
// Falls back to "0.0.0-dev" in non-bundled contexts (tests).
|
|
66755
|
-
pluginVersion: true ? "0.23.
|
|
66770
|
+
pluginVersion: true ? "0.23.17" : "0.0.0-dev"
|
|
66756
66771
|
});
|
|
66757
66772
|
this._telemetryReporter.startAutoFlush(3e4);
|
|
66758
66773
|
}
|
|
@@ -67075,7 +67090,7 @@ var init_channel = __esm({
|
|
|
67075
67090
|
agentVersion: this.config.agentVersion ?? "0.0.0",
|
|
67076
67091
|
// __AV_VERSION__ is injected by esbuild from package.json at build time.
|
|
67077
67092
|
// Falls back to "0.0.0-dev" in non-bundled contexts (tests).
|
|
67078
|
-
pluginVersion: true ? "0.23.
|
|
67093
|
+
pluginVersion: true ? "0.23.17" : "0.0.0-dev"
|
|
67079
67094
|
});
|
|
67080
67095
|
this._telemetryReporter.startAutoFlush(3e4);
|
|
67081
67096
|
}
|
|
@@ -68474,10 +68489,10 @@ ${messageText}`;
|
|
|
68474
68489
|
await mlsGroup.processCommit(commitBytes);
|
|
68475
68490
|
await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
|
|
68476
68491
|
console.log(`[SecureChannel] MLS commit processed for room ${roomId.slice(0, 8)} (epoch=${mlsGroup.epoch})`);
|
|
68492
|
+
this._mlsCommitFailCounts.delete(roomId);
|
|
68477
68493
|
} catch (err) {
|
|
68478
68494
|
await this._onCommitFailure(roomId, groupId, err, `room ${roomId.slice(0, 8)}`);
|
|
68479
68495
|
}
|
|
68480
|
-
this._mlsCommitFailCounts.delete(roomId);
|
|
68481
68496
|
} else {
|
|
68482
68497
|
this._bufferMlsCommit(groupId, epoch, data);
|
|
68483
68498
|
console.log(`[SecureChannel] Buffered MLS commit for room ${roomId.slice(0, 8)} (epoch=${epoch}, group not initialized)`);
|
|
@@ -68494,10 +68509,10 @@ ${messageText}`;
|
|
|
68494
68509
|
await mlsGroup.processCommit(commitBytes);
|
|
68495
68510
|
await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
|
|
68496
68511
|
console.log(`[SecureChannel] MLS commit processed for A2A ${chId.slice(0, 8)} (epoch=${mlsGroup.epoch})`);
|
|
68512
|
+
this._mlsCommitFailCounts.delete(`a2a:${chId}`);
|
|
68497
68513
|
} catch (err) {
|
|
68498
68514
|
await this._onCommitFailure(`a2a:${chId}`, groupId, err, `A2A ${chId.slice(0, 8)}`);
|
|
68499
68515
|
}
|
|
68500
|
-
this._mlsCommitFailCounts.delete(`a2a:${chId}`);
|
|
68501
68516
|
} else {
|
|
68502
68517
|
this._bufferMlsCommit(groupId, epoch, data);
|
|
68503
68518
|
console.log(`[SecureChannel] Buffered MLS commit for A2A ${chId.slice(0, 8)} (epoch=${epoch}, group not initialized)`);
|
|
@@ -70367,7 +70382,7 @@ ${messageText}`;
|
|
|
70367
70382
|
return;
|
|
70368
70383
|
}
|
|
70369
70384
|
this._authFailedThisSession = true;
|
|
70370
|
-
const authReason = data?.reason
|
|
70385
|
+
const authReason = data?.reason ?? "device_revoked";
|
|
70371
70386
|
console.warn(
|
|
70372
70387
|
`[SecureChannel] connection_rejected (reason=${data?.reason ?? "unknown"}, retryable=false) \u2014 terminal; surfacing auth_failed`
|
|
70373
70388
|
);
|
|
@@ -97372,7 +97387,7 @@ var init_index = __esm({
|
|
|
97372
97387
|
init_skill_invoker();
|
|
97373
97388
|
await init_skill_telemetry();
|
|
97374
97389
|
await init_policy_enforcer();
|
|
97375
|
-
VERSION = true ? "0.23.
|
|
97390
|
+
VERSION = true ? "0.23.17" : "0.0.0-dev";
|
|
97376
97391
|
}
|
|
97377
97392
|
});
|
|
97378
97393
|
await init_index();
|