@agentvault/claude-bridge 0.8.31 → 0.8.33
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/README.md +5 -5
- package/dist/index.js +151 -8
- package/dist/info-flags.d.ts +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ room automatically.
|
|
|
10
10
|
### Recommended — env var form (safe, not visible via `ps`)
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
|
-
AV_INVITE_TOKEN=av_tok_… npx @agentvault/claude-bridge
|
|
13
|
+
AV_AGENT_NAME=<agent-name> AV_INVITE_TOKEN=av_tok_… npx @agentvault/claude-bridge
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Because the token is in the environment rather than in the process argument
|
|
@@ -20,7 +20,7 @@ Prefer this form, especially on shared machines.
|
|
|
20
20
|
### Convenience — positional arg form
|
|
21
21
|
|
|
22
22
|
```sh
|
|
23
|
-
npx @agentvault/claude-bridge av_tok_…
|
|
23
|
+
AV_AGENT_NAME=<agent-name> npx @agentvault/claude-bridge av_tok_…
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
> **Security caveat:** the token is visible to other local users via `ps` and
|
|
@@ -32,10 +32,10 @@ npx @agentvault/claude-bridge av_tok_…
|
|
|
32
32
|
|
|
33
33
|
| Variable | Default | Description |
|
|
34
34
|
|---|---|---|
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
35
|
+
| `AV_AGENT_NAME` | *(required)* | Your agent's AgentVault name. It also picks where this agent's credentials live |
|
|
36
|
+
| `AV_INVITE_TOKEN` | *(first run only)* | Invite token (preferred over the positional arg). A saved data dir reconnects without it |
|
|
37
|
+
| `AV_DATA_DIR` | `~/.agentvault/claude-room-bridge/<agent-name>` | Local state directory for MLS keys and session data |
|
|
37
38
|
| `AV_API_URL` | `https://api.agentvault.chat` | AgentVault API base URL |
|
|
38
|
-
| `AV_AGENT_NAME` | `CClaude` | Display name shown in the room roster |
|
|
39
39
|
| `AV_ROOM_ID` | *(all rooms)* | Restrict replies to a specific room UUID |
|
|
40
40
|
|
|
41
41
|
## Authentication
|
package/dist/index.js
CHANGED
|
@@ -11731,11 +11731,11 @@ async function joinWithFirstMatchingKp(welcomeBytes, candidates) {
|
|
|
11731
11731
|
return null;
|
|
11732
11732
|
}
|
|
11733
11733
|
function ownIdentity() {
|
|
11734
|
-
const v22 = true ? "0.23.
|
|
11734
|
+
const v22 = true ? "0.23.63" : FALLBACK;
|
|
11735
11735
|
return `${PACKAGE}@${v22}`;
|
|
11736
11736
|
}
|
|
11737
11737
|
function buildSha() {
|
|
11738
|
-
const raw = true ? "
|
|
11738
|
+
const raw = true ? "52249f2" : "";
|
|
11739
11739
|
const cleaned = (raw ?? "").trim();
|
|
11740
11740
|
return !cleaned || cleaned === "unknown" ? null : cleaned;
|
|
11741
11741
|
}
|
|
@@ -70996,6 +70996,16 @@ var init_dist = __esm({
|
|
|
70996
70996
|
*/
|
|
70997
70997
|
static _KP_REPLENISH_INTERVAL_MS = 6 * 60 * 60 * 1e3;
|
|
70998
70998
|
_kpReplenishTimer = null;
|
|
70999
|
+
/**
|
|
71000
|
+
* #1094: how often each live group's key proof is re-reported — the web
|
|
71001
|
+
* reporter's cadence (`use-key-proof-reporter.ts`), against the server's 24h
|
|
71002
|
+
* staleness window. Re-reading the CURRENT epoch on a timer is self-correcting
|
|
71003
|
+
* whatever moved it, which is why no commit site is hooked.
|
|
71004
|
+
*/
|
|
71005
|
+
static _KEY_PROOF_INTERVAL_MS = 10 * 60 * 1e3;
|
|
71006
|
+
/** #1094: never let one slow report hold up the rest. */
|
|
71007
|
+
static _KEY_PROOF_FETCH_TIMEOUT_MS = 1e4;
|
|
71008
|
+
_keyProofTimer = null;
|
|
70999
71009
|
_a2aReconcileTimer = null;
|
|
71000
71010
|
_deliveryPulling = false;
|
|
71001
71011
|
_drDeliveryPulling = false;
|
|
@@ -73237,7 +73247,7 @@ ${text}`,
|
|
|
73237
73247
|
*/
|
|
73238
73248
|
sendActivitySpan(spanData) {
|
|
73239
73249
|
if (!this._ws || this._ws.readyState !== WebSocket2.OPEN) return;
|
|
73240
|
-
const pluginVersion = true ? "0.23.
|
|
73250
|
+
const pluginVersion = true ? "0.23.63" : "0.0.0-dev";
|
|
73241
73251
|
const agentName = this.config.agentName ?? "Agent";
|
|
73242
73252
|
const resource = {
|
|
73243
73253
|
"service.name": "agentvault-agent",
|
|
@@ -74441,6 +74451,7 @@ ${text}`,
|
|
|
74441
74451
|
this._telemetryReporter = null;
|
|
74442
74452
|
}
|
|
74443
74453
|
this._stopA2aReconcileTimer();
|
|
74454
|
+
this._stopKeyProofTimer();
|
|
74444
74455
|
if (this._ws) {
|
|
74445
74456
|
this._ws.removeAllListeners();
|
|
74446
74457
|
this._ws.close();
|
|
@@ -75447,7 +75458,7 @@ ${text}`,
|
|
|
75447
75458
|
agentVersion: this.config.agentVersion ?? "0.0.0",
|
|
75448
75459
|
// __AV_VERSION__ is injected by esbuild from package.json at build time.
|
|
75449
75460
|
// Falls back to "0.0.0-dev" in non-bundled contexts (tests).
|
|
75450
|
-
pluginVersion: true ? "0.23.
|
|
75461
|
+
pluginVersion: true ? "0.23.63" : "0.0.0-dev"
|
|
75451
75462
|
});
|
|
75452
75463
|
this._telemetryReporter.startAutoFlush(3e4);
|
|
75453
75464
|
}
|
|
@@ -75458,6 +75469,7 @@ ${text}`,
|
|
|
75458
75469
|
if (aborted22()) return;
|
|
75459
75470
|
await this._ensureKpPoolPublished();
|
|
75460
75471
|
this._startKpReplenishTimer();
|
|
75472
|
+
this._startKeyProofTimer();
|
|
75461
75473
|
this._pullDeliveryQueue().catch((err) => {
|
|
75462
75474
|
console.warn("[SecureChannel] Initial delivery pull failed:", err);
|
|
75463
75475
|
});
|
|
@@ -75779,7 +75791,7 @@ ${text}`,
|
|
|
75779
75791
|
agentVersion: this.config.agentVersion ?? "0.0.0",
|
|
75780
75792
|
// __AV_VERSION__ is injected by esbuild from package.json at build time.
|
|
75781
75793
|
// Falls back to "0.0.0-dev" in non-bundled contexts (tests).
|
|
75782
|
-
pluginVersion: true ? "0.23.
|
|
75794
|
+
pluginVersion: true ? "0.23.63" : "0.0.0-dev"
|
|
75783
75795
|
});
|
|
75784
75796
|
this._telemetryReporter.startAutoFlush(3e4);
|
|
75785
75797
|
}
|
|
@@ -76158,6 +76170,7 @@ ${text}`,
|
|
|
76158
76170
|
}
|
|
76159
76171
|
this._stopA2aReconcileTimer();
|
|
76160
76172
|
this._stopKpReplenishTimer();
|
|
76173
|
+
this._stopKeyProofTimer();
|
|
76161
76174
|
if (this._stopped) return;
|
|
76162
76175
|
this._setState("disconnected");
|
|
76163
76176
|
this._scheduleReconnect();
|
|
@@ -78648,6 +78661,82 @@ ${baseText}`;
|
|
|
78648
78661
|
this._kpReplenishTimer = null;
|
|
78649
78662
|
}
|
|
78650
78663
|
}
|
|
78664
|
+
/** #1094: start reporting key proofs (now, then every interval). Idempotent. */
|
|
78665
|
+
_startKeyProofTimer() {
|
|
78666
|
+
this._stopKeyProofTimer();
|
|
78667
|
+
void this._reportKeyProofs();
|
|
78668
|
+
this._keyProofTimer = setInterval(() => {
|
|
78669
|
+
void this._reportKeyProofs();
|
|
78670
|
+
}, _SecureChannel._KEY_PROOF_INTERVAL_MS);
|
|
78671
|
+
}
|
|
78672
|
+
_stopKeyProofTimer() {
|
|
78673
|
+
if (this._keyProofTimer) {
|
|
78674
|
+
clearInterval(this._keyProofTimer);
|
|
78675
|
+
this._keyProofTimer = null;
|
|
78676
|
+
}
|
|
78677
|
+
}
|
|
78678
|
+
/**
|
|
78679
|
+
* #1094: prove, per live MLS group, that this agent can read it.
|
|
78680
|
+
*
|
|
78681
|
+
* `mls_key_proofs` answers "can this roster member actually decrypt?" — the
|
|
78682
|
+
* question nothing else can — but until now only browsers ever wrote one, so
|
|
78683
|
+
* a stuck agent (smartcode sat at epoch 1 in a group at 71 for two days,
|
|
78684
|
+
* #991) was invisible to the server. Same payload as the web reporter: the
|
|
78685
|
+
* epoch and RFC 9420 §8.2's `epoch_authenticator`, which only a holder of
|
|
78686
|
+
* the group's current state can compute and every member computes alike.
|
|
78687
|
+
*
|
|
78688
|
+
* A manager with no usable state reports nothing: the server reads that
|
|
78689
|
+
* absence as "cannot be shown to read", which is the honest signal. Each
|
|
78690
|
+
* group is reported once even when several keys share one manager. Never
|
|
78691
|
+
* throws; a failed report is logged at debug and changes nothing.
|
|
78692
|
+
*/
|
|
78693
|
+
async _reportKeyProofs() {
|
|
78694
|
+
const deviceId = this._deviceId;
|
|
78695
|
+
const jwt2 = this._deviceJwt;
|
|
78696
|
+
if (!deviceId || !jwt2) return;
|
|
78697
|
+
const best = /* @__PURE__ */ new Map();
|
|
78698
|
+
for (const mgr of this._mlsGroups.values()) {
|
|
78699
|
+
try {
|
|
78700
|
+
if (!mgr.isInitialized) continue;
|
|
78701
|
+
const epoch = Number(mgr.epoch);
|
|
78702
|
+
if (epoch <= 0) continue;
|
|
78703
|
+
const groupId = _SecureChannel._mlsGroupIdString(mgr.groupId);
|
|
78704
|
+
if (!groupId) continue;
|
|
78705
|
+
const prev = best.get(groupId);
|
|
78706
|
+
if (prev && epoch <= prev.epoch) continue;
|
|
78707
|
+
best.set(groupId, { epoch, authenticator: Buffer.from(mgr.epochAuthenticator).toString("hex") });
|
|
78708
|
+
} catch {
|
|
78709
|
+
continue;
|
|
78710
|
+
}
|
|
78711
|
+
}
|
|
78712
|
+
for (const [groupId, { epoch, authenticator }] of best) {
|
|
78713
|
+
try {
|
|
78714
|
+
const res = await fetch(`${this.config.apiUrl}/api/v1/mls/groups/${groupId}/key-proof`, {
|
|
78715
|
+
method: "POST",
|
|
78716
|
+
headers: { Authorization: `Bearer ${jwt2}`, "Content-Type": "application/json" },
|
|
78717
|
+
body: JSON.stringify({ device_id: deviceId, epoch, authenticator }),
|
|
78718
|
+
signal: AbortSignal.timeout(_SecureChannel._KEY_PROOF_FETCH_TIMEOUT_MS)
|
|
78719
|
+
});
|
|
78720
|
+
if (!res.ok) console.debug(`[key-proof] ${groupId.slice(0, 8)}: HTTP ${res.status}`);
|
|
78721
|
+
} catch (err) {
|
|
78722
|
+
console.debug(`[key-proof] ${groupId.slice(0, 8)}: report failed (non-critical):`, err);
|
|
78723
|
+
}
|
|
78724
|
+
}
|
|
78725
|
+
}
|
|
78726
|
+
/**
|
|
78727
|
+
* The wire MLS group id as a UUID string, or null. Every founder today —
|
|
78728
|
+
* ts-mls and Hermes alike — uses the server's UUID string as UTF-8 (36
|
|
78729
|
+
* bytes). A 16-byte id (the UUID's raw bytes) is mapped too, defensively:
|
|
78730
|
+
* dropping one would leave this agent "never proved" in that group.
|
|
78731
|
+
*/
|
|
78732
|
+
static _mlsGroupIdString(raw) {
|
|
78733
|
+
if (raw.length === 16) {
|
|
78734
|
+
const h22 = Buffer.from(raw).toString("hex");
|
|
78735
|
+
return `${h22.slice(0, 8)}-${h22.slice(8, 12)}-${h22.slice(12, 16)}-${h22.slice(16, 20)}-${h22.slice(20)}`;
|
|
78736
|
+
}
|
|
78737
|
+
const s22 = new TextDecoder().decode(raw).toLowerCase();
|
|
78738
|
+
return UUID_RE4.test(s22) ? s22 : null;
|
|
78739
|
+
}
|
|
78651
78740
|
/**
|
|
78652
78741
|
* The server's EXPIRY-AWARE usable KeyPackage count, or null when unknown.
|
|
78653
78742
|
*
|
|
@@ -102286,7 +102375,7 @@ data:
|
|
|
102286
102375
|
await init_policy_enforcer();
|
|
102287
102376
|
init_room_protocol();
|
|
102288
102377
|
init_tool_telemetry();
|
|
102289
|
-
VERSION = true ? "0.23.
|
|
102378
|
+
VERSION = true ? "0.23.63" : "0.0.0-dev";
|
|
102290
102379
|
}
|
|
102291
102380
|
});
|
|
102292
102381
|
await init_index();
|
|
@@ -146044,7 +146133,61 @@ function identityPrompt(agentName) {
|
|
|
146044
146133
|
|
|
146045
146134
|
// src/index.ts
|
|
146046
146135
|
init_log();
|
|
146136
|
+
|
|
146137
|
+
// src/info-flags.ts
|
|
146138
|
+
var VERSION_FLAGS = ["--version", "-v"];
|
|
146139
|
+
var HELP_FLAGS = ["--help", "-h"];
|
|
146140
|
+
function bridgeVersion(version3) {
|
|
146141
|
+
return `@agentvault/claude-bridge@${version3 ?? "dev"}`;
|
|
146142
|
+
}
|
|
146143
|
+
function helpText(version3) {
|
|
146144
|
+
return [
|
|
146145
|
+
"",
|
|
146146
|
+
version3,
|
|
146147
|
+
"",
|
|
146148
|
+
" Bridges a Claude agent into E2E-encrypted AgentVault DMs and rooms.",
|
|
146149
|
+
"",
|
|
146150
|
+
"USAGE",
|
|
146151
|
+
" agentvault-claude-bridge [<invite-token>]",
|
|
146152
|
+
" agentvault-claude-bridge <install|uninstall|restart|status|logs>",
|
|
146153
|
+
" agentvault-claude-bridge doctor",
|
|
146154
|
+
"",
|
|
146155
|
+
"FLAGS",
|
|
146156
|
+
" --version, -v Print the version.",
|
|
146157
|
+
" --help, -h Print this.",
|
|
146158
|
+
"",
|
|
146159
|
+
"ENV",
|
|
146160
|
+
" AV_AGENT_NAME The agent's AgentVault name. Required.",
|
|
146161
|
+
" AV_INVITE_TOKEN First enrolment only; a saved data dir reconnects without it.",
|
|
146162
|
+
" AV_DATA_DIR Credential/state dir. Defaults per agent.",
|
|
146163
|
+
" AV_ROOM_ID Only answer in this room.",
|
|
146164
|
+
"",
|
|
146165
|
+
"NOTES",
|
|
146166
|
+
" Sign in to Claude on this machine first; ANTHROPIC_API_KEY is the fallback.",
|
|
146167
|
+
" To restart later use `restart`, never `install`.",
|
|
146168
|
+
""
|
|
146169
|
+
].join("\n");
|
|
146170
|
+
}
|
|
146171
|
+
function answerInfoFlags(argv, version3, print) {
|
|
146172
|
+
const first = argv[2];
|
|
146173
|
+
if (!first) return false;
|
|
146174
|
+
const label = bridgeVersion(version3);
|
|
146175
|
+
if (VERSION_FLAGS.includes(first)) {
|
|
146176
|
+
print(label);
|
|
146177
|
+
return true;
|
|
146178
|
+
}
|
|
146179
|
+
if (HELP_FLAGS.includes(first)) {
|
|
146180
|
+
print(helpText(label));
|
|
146181
|
+
return true;
|
|
146182
|
+
}
|
|
146183
|
+
return false;
|
|
146184
|
+
}
|
|
146185
|
+
|
|
146186
|
+
// src/index.ts
|
|
146047
146187
|
async function main() {
|
|
146188
|
+
if (answerInfoFlags(process.argv, true ? "0.8.33" : void 0, printLine)) {
|
|
146189
|
+
process.exit(0);
|
|
146190
|
+
}
|
|
146048
146191
|
if (process.argv[2] === "recovery" && await (await init_recovery().then(() => recovery_exports)).maybeRunRecoverySubcommand()) {
|
|
146049
146192
|
process.exit(process.exitCode ?? 0);
|
|
146050
146193
|
}
|
|
@@ -146070,7 +146213,7 @@ async function main() {
|
|
|
146070
146213
|
"[bridge] warning: passing the invite token on the command line is visible to other local users via 'ps'. Prefer: AV_INVITE_TOKEN=\u2026 npx @agentvault/claude-bridge"
|
|
146071
146214
|
);
|
|
146072
146215
|
}
|
|
146073
|
-
logLine(`[bridge] version: ${true ? "0.8.
|
|
146216
|
+
logLine(`[bridge] version: ${true ? "0.8.33" : "dev"}`);
|
|
146074
146217
|
logLine(`[bridge] data dir: ${cfg.dataDir} (${cfg.dataDirSource})`);
|
|
146075
146218
|
logLine(`[bridge] workspace: ${cfg.workspaceDir} \xB7 permissions: ${cfg.permissionMode} \xB7 enclave dir fenced`);
|
|
146076
146219
|
if (cfg.armRoom) {
|
|
@@ -146102,7 +146245,7 @@ async function main() {
|
|
|
146102
146245
|
// its default would render "@agentvault/agentvault@0.7.x" — the wrong
|
|
146103
146246
|
// package name attached to the bridge's version number, which is worse
|
|
146104
146247
|
// than either alone.
|
|
146105
|
-
clientVersion: `@agentvault/claude-bridge@${true ? "0.8.
|
|
146248
|
+
clientVersion: `@agentvault/claude-bridge@${true ? "0.8.33" : "dev"}`
|
|
146106
146249
|
});
|
|
146107
146250
|
const agentSystemPrompt = cfg.systemPrompt ?? identityPrompt(cfg.agentName);
|
|
146108
146251
|
const deviceJwt = () => {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #1512 — `--help` and `--version` answer WITHOUT an agent name.
|
|
3
|
+
*
|
|
4
|
+
* Every other path through index.ts resolves the data dir first, and that
|
|
5
|
+
* refuses a missing AV_AGENT_NAME (#921) — correct for running the bridge, but
|
|
6
|
+
* a new user's first command is usually `--help`, and it read like a crash.
|
|
7
|
+
* The Muse and Grok bridges already answer these before any config.
|
|
8
|
+
*
|
|
9
|
+
* Only when the FIRST argument is one of these flags: `install --help` and the
|
|
10
|
+
* other subcommands keep their own dispatch. Its own module (not index.ts) so a
|
|
11
|
+
* test can import it — index.ts runs main() at module scope.
|
|
12
|
+
*/
|
|
13
|
+
export declare const VERSION_FLAGS: readonly ["--version", "-v"];
|
|
14
|
+
export declare const HELP_FLAGS: readonly ["--help", "-h"];
|
|
15
|
+
export declare function bridgeVersion(version: string | undefined): string;
|
|
16
|
+
export declare function helpText(version: string): string;
|
|
17
|
+
/** Prints and returns true when argv (process.argv) opens with an info flag. */
|
|
18
|
+
export declare function answerInfoFlags(argv: string[], version: string | undefined, print: (text: string) => void): boolean;
|
|
19
|
+
//# sourceMappingURL=info-flags.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentvault/claude-bridge",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.33",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AgentVault Claude Bridge — daemon for bridging a Claude agent into secure E2E-encrypted AgentVault 1:1 direct messages and rooms.",
|
|
6
6
|
"main": "dist/index.js",
|