@agentvault/grok-bridge 0.3.0 → 0.3.2
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/index.js +65 -13
- package/dist/service/subcommand.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -490,8 +490,17 @@ var subcommand_exports = {};
|
|
|
490
490
|
__export(subcommand_exports, {
|
|
491
491
|
maybeRunServiceSubcommand: () => maybeRunServiceSubcommand
|
|
492
492
|
});
|
|
493
|
+
function requireAgentName(env) {
|
|
494
|
+
const name = env.AV_AGENT_NAME?.trim();
|
|
495
|
+
if (!name) {
|
|
496
|
+
throw new Error(
|
|
497
|
+
"AV_AGENT_NAME is required \u2014 it names WHICH agent's service to act on. Re-run as: AV_AGENT_NAME=<agent-name> agentvault-grok-bridge <subcommand>"
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
return name;
|
|
501
|
+
}
|
|
493
502
|
function labelFor(env) {
|
|
494
|
-
return `dev.agentvault.grok-${slugify2(env
|
|
503
|
+
return `dev.agentvault.grok-${slugify2(requireAgentName(env))}`;
|
|
495
504
|
}
|
|
496
505
|
function maybeRunServiceSubcommand(argv, env, deps) {
|
|
497
506
|
const cmd = argv[2];
|
|
@@ -511,6 +520,7 @@ function maybeRunServiceSubcommand(argv, env, deps) {
|
|
|
511
520
|
const log = deps?.log ?? ((m2) => logLine("[grok-bridge] " + m2));
|
|
512
521
|
try {
|
|
513
522
|
if (cmd === "install") {
|
|
523
|
+
requireAgentName(env);
|
|
514
524
|
const cfg = loadConfig(env, []);
|
|
515
525
|
const firstBoot = !hasPersistedCreds(cfg.dataDir) && !!cfg.inviteToken;
|
|
516
526
|
if (firstBoot) {
|
|
@@ -530,7 +540,9 @@ function maybeRunServiceSubcommand(argv, env, deps) {
|
|
|
530
540
|
log("now APPROVE the device in AgentVault \u2014 the service is waiting to enrol");
|
|
531
541
|
log("if it does not connect within a minute, the log above says why");
|
|
532
542
|
}
|
|
533
|
-
log(
|
|
543
|
+
log(
|
|
544
|
+
`check it with: AV_AGENT_NAME=${cfg.agentName} agentvault-grok-bridge status`
|
|
545
|
+
);
|
|
534
546
|
} else if (cmd === "uninstall") {
|
|
535
547
|
const label = labelFor(env);
|
|
536
548
|
backend.uninstall(label);
|
|
@@ -722,6 +734,25 @@ var __toESM = (mod4, isNodeMode, target) => (target = mod4 != null ? __create(__
|
|
|
722
734
|
isNodeMode || !mod4 || !mod4.__esModule ? __defProp2(target, "default", { value: mod4, enumerable: true }) : target,
|
|
723
735
|
mod4
|
|
724
736
|
));
|
|
737
|
+
function toEpoch(v2) {
|
|
738
|
+
if (typeof v2 === "bigint") return v2;
|
|
739
|
+
if (typeof v2 === "number") {
|
|
740
|
+
return Number.isFinite(v2) ? BigInt(Math.trunc(v2)) : null;
|
|
741
|
+
}
|
|
742
|
+
if (typeof v2 === "string" && /^\d+$/.test(v2)) return BigInt(v2);
|
|
743
|
+
return null;
|
|
744
|
+
}
|
|
745
|
+
function classifyCommitFailure(messageEpoch, groupEpoch) {
|
|
746
|
+
const msg = toEpoch(messageEpoch);
|
|
747
|
+
const grp = toEpoch(groupEpoch);
|
|
748
|
+
if (msg === null || grp === null) return "count";
|
|
749
|
+
return msg < grp ? "already-applied" : "count";
|
|
750
|
+
}
|
|
751
|
+
var init_mls_commit_classify = __esm2({
|
|
752
|
+
"src/mls-commit-classify.ts"() {
|
|
753
|
+
"use strict";
|
|
754
|
+
}
|
|
755
|
+
});
|
|
725
756
|
var __filename;
|
|
726
757
|
var __dirname;
|
|
727
758
|
var url2;
|
|
@@ -64069,7 +64100,7 @@ var init_mls_kp_pool = __esm2({
|
|
|
64069
64100
|
}
|
|
64070
64101
|
});
|
|
64071
64102
|
function ownIdentity() {
|
|
64072
|
-
const v2 = true ? "0.23.
|
|
64103
|
+
const v2 = true ? "0.23.23" : FALLBACK;
|
|
64073
64104
|
return `${PACKAGE}@${v2}`;
|
|
64074
64105
|
}
|
|
64075
64106
|
function buildClientVersion(override) {
|
|
@@ -64981,6 +65012,7 @@ var SecureChannel;
|
|
|
64981
65012
|
var init_channel = __esm2({
|
|
64982
65013
|
async "src/channel.ts"() {
|
|
64983
65014
|
"use strict";
|
|
65015
|
+
init_mls_commit_classify();
|
|
64984
65016
|
await init_libsodium_wrappers();
|
|
64985
65017
|
await init_dist();
|
|
64986
65018
|
await init_dist();
|
|
@@ -66047,7 +66079,7 @@ var init_channel = __esm2({
|
|
|
66047
66079
|
*/
|
|
66048
66080
|
sendActivitySpan(spanData) {
|
|
66049
66081
|
if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
|
|
66050
|
-
const pluginVersion = true ? "0.23.
|
|
66082
|
+
const pluginVersion = true ? "0.23.23" : "0.0.0-dev";
|
|
66051
66083
|
const agentName = this.config.agentName ?? "Agent";
|
|
66052
66084
|
const resource = {
|
|
66053
66085
|
"service.name": "agentvault-agent",
|
|
@@ -67957,7 +67989,7 @@ var init_channel = __esm2({
|
|
|
67957
67989
|
agentVersion: this.config.agentVersion ?? "0.0.0",
|
|
67958
67990
|
// __AV_VERSION__ is injected by esbuild from package.json at build time.
|
|
67959
67991
|
// Falls back to "0.0.0-dev" in non-bundled contexts (tests).
|
|
67960
|
-
pluginVersion: true ? "0.23.
|
|
67992
|
+
pluginVersion: true ? "0.23.23" : "0.0.0-dev"
|
|
67961
67993
|
});
|
|
67962
67994
|
this._telemetryReporter.startAutoFlush(3e4);
|
|
67963
67995
|
}
|
|
@@ -68281,7 +68313,7 @@ var init_channel = __esm2({
|
|
|
68281
68313
|
agentVersion: this.config.agentVersion ?? "0.0.0",
|
|
68282
68314
|
// __AV_VERSION__ is injected by esbuild from package.json at build time.
|
|
68283
68315
|
// Falls back to "0.0.0-dev" in non-bundled contexts (tests).
|
|
68284
|
-
pluginVersion: true ? "0.23.
|
|
68316
|
+
pluginVersion: true ? "0.23.23" : "0.0.0-dev"
|
|
68285
68317
|
});
|
|
68286
68318
|
this._telemetryReporter.startAutoFlush(3e4);
|
|
68287
68319
|
}
|
|
@@ -69687,7 +69719,14 @@ ${messageText}`;
|
|
|
69687
69719
|
console.log(`[SecureChannel] MLS commit processed for room ${roomId.slice(0, 8)} (epoch=${mlsGroup.epoch})`);
|
|
69688
69720
|
this._mlsCommitFailCounts.delete(roomId);
|
|
69689
69721
|
} catch (err) {
|
|
69690
|
-
await this._onCommitFailure(
|
|
69722
|
+
await this._onCommitFailure(
|
|
69723
|
+
roomId,
|
|
69724
|
+
groupId,
|
|
69725
|
+
err,
|
|
69726
|
+
`room ${roomId.slice(0, 8)}`,
|
|
69727
|
+
data.epoch,
|
|
69728
|
+
mlsGroup.epoch
|
|
69729
|
+
);
|
|
69691
69730
|
}
|
|
69692
69731
|
} else {
|
|
69693
69732
|
this._bufferMlsCommit(groupId, epoch, data);
|
|
@@ -69707,7 +69746,14 @@ ${messageText}`;
|
|
|
69707
69746
|
console.log(`[SecureChannel] MLS commit processed for A2A ${chId.slice(0, 8)} (epoch=${mlsGroup.epoch})`);
|
|
69708
69747
|
this._mlsCommitFailCounts.delete(`a2a:${chId}`);
|
|
69709
69748
|
} catch (err) {
|
|
69710
|
-
await this._onCommitFailure(
|
|
69749
|
+
await this._onCommitFailure(
|
|
69750
|
+
`a2a:${chId}`,
|
|
69751
|
+
groupId,
|
|
69752
|
+
err,
|
|
69753
|
+
`A2A ${chId.slice(0, 8)}`,
|
|
69754
|
+
data.epoch,
|
|
69755
|
+
mlsGroup.epoch
|
|
69756
|
+
);
|
|
69711
69757
|
}
|
|
69712
69758
|
} else {
|
|
69713
69759
|
this._bufferMlsCommit(groupId, epoch, data);
|
|
@@ -69793,7 +69839,13 @@ ${messageText}`;
|
|
|
69793
69839
|
* Never re-throws. The caller's only handler logs and drops, so throwing here
|
|
69794
69840
|
* is indistinguishable from swallowing — it just moves the swallow one frame up.
|
|
69795
69841
|
*/
|
|
69796
|
-
async _onCommitFailure(groupKey, mlsGroupId, err, label) {
|
|
69842
|
+
async _onCommitFailure(groupKey, mlsGroupId, err, label, messageEpoch, groupEpoch) {
|
|
69843
|
+
if (classifyCommitFailure(messageEpoch, groupEpoch) === "already-applied") {
|
|
69844
|
+
console.debug(
|
|
69845
|
+
`[SecureChannel] Skipping already-applied MLS commit for ${label} (commit epoch ${String(messageEpoch)} is behind group epoch ${String(groupEpoch)})`
|
|
69846
|
+
);
|
|
69847
|
+
return;
|
|
69848
|
+
}
|
|
69797
69849
|
const count = (this._mlsCommitFailCounts.get(groupKey) ?? 0) + 1;
|
|
69798
69850
|
this._mlsCommitFailCounts.set(groupKey, count);
|
|
69799
69851
|
console.error(
|
|
@@ -71691,7 +71743,7 @@ ${messageText}`;
|
|
|
71691
71743
|
return;
|
|
71692
71744
|
}
|
|
71693
71745
|
this._authFailedThisSession = true;
|
|
71694
|
-
const authReason = data?.reason ?? "
|
|
71746
|
+
const authReason = data?.reason ?? "unknown";
|
|
71695
71747
|
console.warn(
|
|
71696
71748
|
`[SecureChannel] connection_rejected (reason=${data?.reason ?? "unknown"}, retryable=false) \u2014 terminal; surfacing auth_failed`
|
|
71697
71749
|
);
|
|
@@ -98272,7 +98324,7 @@ var init_index = __esm2({
|
|
|
98272
98324
|
init_skill_invoker();
|
|
98273
98325
|
await init_skill_telemetry();
|
|
98274
98326
|
await init_policy_enforcer();
|
|
98275
|
-
VERSION = true ? "0.23.
|
|
98327
|
+
VERSION = true ? "0.23.23" : "0.0.0-dev";
|
|
98276
98328
|
}
|
|
98277
98329
|
});
|
|
98278
98330
|
await init_index();
|
|
@@ -99135,7 +99187,7 @@ async function main() {
|
|
|
99135
99187
|
const info = parseInfoFlags(process.argv.slice(2));
|
|
99136
99188
|
if (info.showVersion || info.showHelp) {
|
|
99137
99189
|
const version2 = buildClientVersion2(
|
|
99138
|
-
true ? "0.3.
|
|
99190
|
+
true ? "0.3.2" : void 0
|
|
99139
99191
|
);
|
|
99140
99192
|
if (info.showVersion) printLine(version2);
|
|
99141
99193
|
if (info.showHelp) {
|
|
@@ -99193,7 +99245,7 @@ async function main() {
|
|
|
99193
99245
|
agentName: cfg.agentName,
|
|
99194
99246
|
platform: "node",
|
|
99195
99247
|
clientVersion: buildClientVersion2(
|
|
99196
|
-
true ? "0.3.
|
|
99248
|
+
true ? "0.3.2" : void 0
|
|
99197
99249
|
)
|
|
99198
99250
|
});
|
|
99199
99251
|
channelRef = channel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subcommand.d.ts","sourceRoot":"","sources":["../../src/service/subcommand.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAElE,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;
|
|
1
|
+
{"version":3,"file":"subcommand.d.ts","sourceRoot":"","sources":["../../src/service/subcommand.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAElE,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAiDD;;uFAEuF;AACvF,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAqHT"}
|
package/package.json
CHANGED