@agentvault/grok-bridge 0.4.2 → 0.4.3

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 CHANGED
@@ -64589,17 +64589,28 @@ var init_mls_kp_pool = __esm2({
64589
64589
  }
64590
64590
  });
64591
64591
  function ownIdentity() {
64592
- const v2 = true ? "0.23.29" : FALLBACK;
64592
+ const v2 = true ? "0.23.30" : FALLBACK;
64593
64593
  return `${PACKAGE}@${v2}`;
64594
64594
  }
64595
+ function buildSha() {
64596
+ const raw = true ? "1fff5d6" : "";
64597
+ const cleaned = (raw ?? "").trim();
64598
+ return !cleaned || cleaned === "unknown" ? null : cleaned;
64599
+ }
64600
+ function withBuildSha(identity) {
64601
+ const sha = buildSha();
64602
+ if (!sha || identity.includes("+")) return identity;
64603
+ const stamped = `${identity}+${sha}`;
64604
+ return stamped.length <= MAX_LEN ? stamped : identity;
64605
+ }
64595
64606
  function buildClientVersion(override) {
64596
64607
  try {
64597
64608
  const candidate = (override ?? "").trim();
64598
64609
  if (candidate) {
64599
- const cleaned = candidate.replace(DISALLOWED, "").slice(0, MAX_LEN);
64610
+ const cleaned = withBuildSha(candidate.replace(DISALLOWED, "").slice(0, MAX_LEN));
64600
64611
  if (cleaned && !cleaned.includes("..")) return cleaned;
64601
64612
  }
64602
- return ownIdentity().replace(DISALLOWED, "").slice(0, MAX_LEN);
64613
+ return withBuildSha(ownIdentity().replace(DISALLOWED, "").slice(0, MAX_LEN));
64603
64614
  } catch {
64604
64615
  return FALLBACK;
64605
64616
  }
@@ -66660,7 +66671,7 @@ var init_channel = __esm2({
66660
66671
  */
66661
66672
  sendActivitySpan(spanData) {
66662
66673
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
66663
- const pluginVersion = true ? "0.23.29" : "0.0.0-dev";
66674
+ const pluginVersion = true ? "0.23.30" : "0.0.0-dev";
66664
66675
  const agentName = this.config.agentName ?? "Agent";
66665
66676
  const resource = {
66666
66677
  "service.name": "agentvault-agent",
@@ -68598,7 +68609,7 @@ var init_channel = __esm2({
68598
68609
  agentVersion: this.config.agentVersion ?? "0.0.0",
68599
68610
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
68600
68611
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
68601
- pluginVersion: true ? "0.23.29" : "0.0.0-dev"
68612
+ pluginVersion: true ? "0.23.30" : "0.0.0-dev"
68602
68613
  });
68603
68614
  this._telemetryReporter.startAutoFlush(3e4);
68604
68615
  }
@@ -68922,7 +68933,7 @@ var init_channel = __esm2({
68922
68933
  agentVersion: this.config.agentVersion ?? "0.0.0",
68923
68934
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
68924
68935
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
68925
- pluginVersion: true ? "0.23.29" : "0.0.0-dev"
68936
+ pluginVersion: true ? "0.23.30" : "0.0.0-dev"
68926
68937
  });
68927
68938
  this._telemetryReporter.startAutoFlush(3e4);
68928
68939
  }
@@ -73068,21 +73079,30 @@ var init_gateway_send = __esm2({
73068
73079
  });
73069
73080
  function parseMentions(text) {
73070
73081
  const mentions = [];
73071
- const re2 = /@(\w[\w]*)/gi;
73082
+ const re2 = new RegExp(MENTION_RE.source, MENTION_RE.flags);
73072
73083
  let match;
73073
73084
  while ((match = re2.exec(text)) !== null) {
73074
73085
  mentions.push(match[1].toLowerCase());
73075
73086
  }
73076
73087
  return mentions;
73077
73088
  }
73089
+ function resolveOwn(mention, names) {
73090
+ if (names.has(mention)) return mention;
73091
+ const parts = mention.split("-");
73092
+ for (let i2 = parts.length - 1; i2 > 0; i2--) {
73093
+ const candidate = parts.slice(0, i2).join("-");
73094
+ if (names.has(candidate)) return candidate;
73095
+ }
73096
+ return null;
73097
+ }
73078
73098
  function owesRoomReply(plaintext, agentName, accountId, senderIsAgent, roomDisplayName, ownDisplayName, selfResolved = true) {
73079
73099
  const mentions = parseMentions(plaintext);
73080
73100
  if (mentions.length === 0) return false;
73081
- if (mentions.includes("all") || mentions.includes("everyone")) {
73101
+ const ownNames = ownRoomNames(agentName, accountId, roomDisplayName, ownDisplayName);
73102
+ if (mentions.some((m2) => resolveOwn(m2, ownNames) !== null)) return true;
73103
+ if (mentions.some((m2) => resolveOwn(m2, BROADCAST_NAMES) !== null)) {
73082
73104
  return senderIsAgent !== true;
73083
73105
  }
73084
- const ownNames = ownRoomNames(agentName, accountId, roomDisplayName, ownDisplayName);
73085
- if (mentions.some((m2) => ownNames.has(m2))) return true;
73086
73106
  if (!selfResolved) return true;
73087
73107
  return false;
73088
73108
  }
@@ -73100,9 +73120,13 @@ function ownRoomNames(agentName, accountId, roomDisplayName, ownDisplayName) {
73100
73120
  add4(ownDisplayName);
73101
73121
  return names;
73102
73122
  }
73123
+ var MENTION_RE;
73124
+ var BROADCAST_NAMES;
73103
73125
  var init_room_protocol = __esm2({
73104
73126
  "src/room-protocol.ts"() {
73105
73127
  "use strict";
73128
+ MENTION_RE = /@([\w-]+)/gi;
73129
+ BROADCAST_NAMES = /* @__PURE__ */ new Set(["all", "everyone"]);
73106
73130
  }
73107
73131
  });
73108
73132
  var init_llm_response_parser = __esm2({
@@ -99198,7 +99222,7 @@ var init_index = __esm2({
99198
99222
  await init_skill_telemetry();
99199
99223
  await init_policy_enforcer();
99200
99224
  init_room_protocol();
99201
- VERSION = true ? "0.23.29" : "0.0.0-dev";
99225
+ VERSION = true ? "0.23.30" : "0.0.0-dev";
99202
99226
  }
99203
99227
  });
99204
99228
  await init_index();
@@ -100124,7 +100148,7 @@ async function main() {
100124
100148
  const info = parseInfoFlags(process.argv.slice(2));
100125
100149
  if (info.showVersion || info.showHelp) {
100126
100150
  const version2 = buildClientVersion2(
100127
- true ? "0.4.2" : void 0
100151
+ true ? "0.4.3" : void 0
100128
100152
  );
100129
100153
  if (info.showVersion) printLine(version2);
100130
100154
  if (info.showHelp) {
@@ -100177,7 +100201,7 @@ async function main() {
100177
100201
  agentName: cfg.agentName,
100178
100202
  platform: "node",
100179
100203
  clientVersion: buildClientVersion2(
100180
- true ? "0.4.2" : void 0
100204
+ true ? "0.4.3" : void 0
100181
100205
  )
100182
100206
  });
100183
100207
  channelRef = channel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/grok-bridge",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
5
  "description": "AgentVault Grok Bridge — daemon bridging a Grok agent into E2E-encrypted AgentVault direct messages and rooms.",
6
6
  "main": "dist/index.js",
@@ -1,57 +0,0 @@
1
- import { type BridgeConfig } from "../config.js";
2
- import type { ReapResult } from "../reap.js";
3
- import { type ServiceBackend } from "./backend.js";
4
- export interface InstallOnReadyDeps {
5
- entrypoint: string;
6
- env: NodeJS.ProcessEnv;
7
- backend?: ServiceBackend;
8
- hasCreds?: (dataDir: string) => boolean;
9
- /** Contents of the installed launcher, or undefined when none is installed. */
10
- readLauncher?: (path: string) => string | undefined;
11
- fenceAuthExists?: (fenceHome: string) => boolean;
12
- /** Resolves when no turn is in flight (GrokSession.idle). See rule 2. */
13
- waitForIdle?: () => Promise<void>;
14
- /** Bound on that wait. The terminal coming back is the product promise, so a
15
- * wedged turn must never hold the customer's shell open. */
16
- idleTimeoutMs?: number;
17
- /** The ONE teardown (src/reap.ts). Must complete before launchctl runs. */
18
- reap: () => Promise<ReapResult>;
19
- exit: (code: number) => void;
20
- log: (msg: string) => void;
21
- }
22
- interface ReadyChannel {
23
- on(ev: "ready", cb: () => void): unknown;
24
- }
25
- /**
26
- * One-paste install: enrol in the foreground, hand off to the supervisor, exit —
27
- * so the customer's terminal comes back and the agent survives a reboot.
28
- *
29
- * Four rules this module exists to enforce.
30
- *
31
- * 1. REFUSE BEFORE REAPING. Everything that can say no does so before anything is
32
- * torn down. Refusing afterwards leaves the customer with an approved device,
33
- * a spent invite token, and no running process — strictly worse than never
34
- * having guarded at all.
35
- *
36
- * 2. REAP COMPLETELY, THEN BOOTSTRAP. `LaunchdBackend.install` runs bootout →
37
- * poll-until-gone → bootstrap → kickstart synchronously, so the service is
38
- * live the instant install returns. A partial teardown means two ACP sessions
39
- * and two WebSockets on one device. `reap()` reports failure rather than
40
- * swallowing it, and a failed reap is a refusal.
41
- *
42
- * 3. COMPARE, DON'T DETECT. `status().loaded` means only that a plist with this
43
- * label exists. The old `install` subcommand never guarded its entrypoint
44
- * (subcommand.ts), so a customer can hold a LOADED plist baked against a
45
- * pruned npx cache; restarting that repairs nothing and reports success.
46
- * Restart only when a service is loaded AND its baked entrypoint is the one we
47
- * would install. Compare the ENTRYPOINT, never the whole launcher script —
48
- * that embeds the install-time PATH and is volatile across shells.
49
- *
50
- * 4. VERIFY BEFORE CLAIMING. `backend.install` returns void, and launchd's
51
- * implementation runs `kickstart` regardless of every `bootstrap` exit code.
52
- * This log line is the customer's only feedback, so it comes after a
53
- * `status()` that returned loaded:true.
54
- */
55
- export declare function installOnReady(channel: ReadyChannel, cfg: BridgeConfig, deps: InstallOnReadyDeps): void;
56
- export {};
57
- //# sourceMappingURL=install-on-ready.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install-on-ready.d.ts","sourceRoot":"","sources":["../../src/service/install-on-ready.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4C,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAElE,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IACxC,+EAA+E;IAC/E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACpD,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IACjD,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC;iEAC6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IAChC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5B;AAMD,UAAU,YAAY;IACpB,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,kBAAkB,GACvB,IAAI,CAgHN"}