@agentvault/agentvault 0.23.43 → 0.23.44

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.
@@ -0,0 +1,23 @@
1
+ /**
2
+ * #1241 — the text of a decrypted inbound envelope, never the raw envelope JSON.
3
+ *
4
+ * Every inbound parse site used to do `parsed.text ?? plaintext`. `??` (since
5
+ * #1219) stops `text: ""` from falling through, but when the `text` KEY is
6
+ * absent — or null, or not a string — `parsed.text` is nullish and the fallback
7
+ * is the WHOLE envelope JSON string, `attachment.fileKey` / `fileNonce`
8
+ * included. That string then becomes the room caption (the @ gate and the model
9
+ * prompt), the history entry replayed for the next 20 turns, and the
10
+ * `room_message` emit.
11
+ *
12
+ * Measured 2026-09-13 (issue #1241): no live sender produces a `type:"message"`
13
+ * envelope without a `text` string, so this is hardening — but the receiver
14
+ * must not depend on every present and future sender being well-formed.
15
+ *
16
+ * Rule: if `parsed` looks like one of our envelopes (an object carrying `type`
17
+ * or `attachment`), its text is `text` when that is a string and `""`
18
+ * otherwise. The raw-string fallback survives ONLY for plaintext that is not an
19
+ * envelope at all (a bare JSON scalar, or an object with neither key — the
20
+ * shape older status/heartbeat payloads use, whose behaviour is unchanged here).
21
+ */
22
+ export declare function envelopeText(parsed: unknown, raw: string): string;
23
+ //# sourceMappingURL=envelope-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope-text.d.ts","sourceRoot":"","sources":["../src/envelope-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAOjE"}
package/dist/index.js CHANGED
@@ -53,6 +53,21 @@ var init_abstention = __esm({
53
53
  }
54
54
  });
55
55
 
56
+ // src/envelope-text.ts
57
+ function envelopeText(parsed, raw) {
58
+ if (parsed !== null && typeof parsed === "object") {
59
+ const obj = parsed;
60
+ if (typeof obj.text === "string") return obj.text;
61
+ if ("type" in obj || "attachment" in obj) return "";
62
+ }
63
+ return raw;
64
+ }
65
+ var init_envelope_text = __esm({
66
+ "src/envelope-text.ts"() {
67
+ "use strict";
68
+ }
69
+ });
70
+
56
71
  // src/mls-commit-classify.ts
57
72
  function toEpoch(v2) {
58
73
  if (typeof v2 === "bigint") return v2;
@@ -63341,11 +63356,11 @@ var init_mls_kp_pool = __esm({
63341
63356
 
63342
63357
  // src/client-version.ts
63343
63358
  function ownIdentity() {
63344
- const v2 = true ? "0.23.43" : FALLBACK;
63359
+ const v2 = true ? "0.23.44" : FALLBACK;
63345
63360
  return `${PACKAGE}@${v2}`;
63346
63361
  }
63347
63362
  function buildSha() {
63348
- const raw = true ? "07fcc99-dirty" : "";
63363
+ const raw = true ? "765ae19-dirty" : "";
63349
63364
  const cleaned = (raw ?? "").trim();
63350
63365
  return !cleaned || cleaned === "unknown" ? null : cleaned;
63351
63366
  }
@@ -64279,6 +64294,7 @@ var init_channel = __esm({
64279
64294
  async "src/channel.ts"() {
64280
64295
  "use strict";
64281
64296
  init_abstention();
64297
+ init_envelope_text();
64282
64298
  init_mls_commit_classify();
64283
64299
  init_room_protocol();
64284
64300
  await init_libsodium_wrappers();
@@ -65608,7 +65624,7 @@ ${text}`;
65608
65624
  */
65609
65625
  sendActivitySpan(spanData) {
65610
65626
  if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
65611
- const pluginVersion = true ? "0.23.43" : "0.0.0-dev";
65627
+ const pluginVersion = true ? "0.23.44" : "0.0.0-dev";
65612
65628
  const agentName = this.config.agentName ?? "Agent";
65613
65629
  const resource = {
65614
65630
  "service.name": "agentvault-agent",
@@ -67546,7 +67562,7 @@ ${text}`;
67546
67562
  agentVersion: this.config.agentVersion ?? "0.0.0",
67547
67563
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
67548
67564
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
67549
- pluginVersion: true ? "0.23.43" : "0.0.0-dev"
67565
+ pluginVersion: true ? "0.23.44" : "0.0.0-dev"
67550
67566
  });
67551
67567
  this._telemetryReporter.startAutoFlush(3e4);
67552
67568
  }
@@ -67870,7 +67886,7 @@ ${text}`;
67870
67886
  agentVersion: this.config.agentVersion ?? "0.0.0",
67871
67887
  // __AV_VERSION__ is injected by esbuild from package.json at build time.
67872
67888
  // Falls back to "0.0.0-dev" in non-bundled contexts (tests).
67873
- pluginVersion: true ? "0.23.43" : "0.0.0-dev"
67889
+ pluginVersion: true ? "0.23.44" : "0.0.0-dev"
67874
67890
  });
67875
67891
  this._telemetryReporter.startAutoFlush(3e4);
67876
67892
  }
@@ -68324,7 +68340,7 @@ ${text}`;
68324
68340
  let mlsAttachment = null;
68325
68341
  try {
68326
68342
  const parsed = JSON.parse(plaintext);
68327
- text = parsed.text ?? plaintext;
68343
+ text = envelopeText(parsed, plaintext);
68328
68344
  messageType = parsed.type ?? "text";
68329
68345
  topicId = parsed.topicId ?? topicId;
68330
68346
  if (parsed.attachment) mlsAttachment = parsed.attachment;
@@ -68519,7 +68535,7 @@ ${text}`;
68519
68535
  try {
68520
68536
  const parsed = JSON.parse(plaintext);
68521
68537
  messageType = parsed.type || "message";
68522
- messageText = parsed.text ?? plaintext;
68538
+ messageText = envelopeText(parsed, plaintext);
68523
68539
  if (parsed.attachment) {
68524
68540
  attachmentInfo = parsed.attachment;
68525
68541
  }
@@ -69277,14 +69293,14 @@ ${baseText}`;
69277
69293
  try {
69278
69294
  const parsed = JSON.parse(rawPlaintext);
69279
69295
  messageType = parsed.type || "message";
69280
- messageText = parsed.text ?? rawPlaintext;
69296
+ messageText = envelopeText(parsed, rawPlaintext);
69281
69297
  if (parsed.attachment) roomAttachment = parsed.attachment;
69282
69298
  } catch {
69283
69299
  messageType = "message";
69284
69300
  messageText = rawPlaintext;
69285
69301
  }
69286
69302
  if (CREDENTIAL_MESSAGE_TYPES.has(messageType)) {
69287
- this._handleCredentialMessage(resolvedRoomId, messageType, messageText, data.message_id);
69303
+ this._handleCredentialMessage(resolvedRoomId, messageType, rawPlaintext, data.message_id);
69288
69304
  if (data.created_at && this._persisted) {
69289
69305
  this._persisted.lastMessageTimestamp = data.created_at;
69290
69306
  }
@@ -69293,7 +69309,7 @@ ${baseText}`;
69293
69309
  }
69294
69310
  if (CATCHUP_MESSAGE_TYPES.has(messageType)) {
69295
69311
  if (messageType === "history_catchup_request") {
69296
- await this._handleHistoryCatchupRequest(resolvedRoomId, messageText, data.message_id);
69312
+ await this._handleHistoryCatchupRequest(resolvedRoomId, rawPlaintext, data.message_id);
69297
69313
  }
69298
69314
  return;
69299
69315
  }
@@ -71277,7 +71293,7 @@ ${baseText}`;
71277
71293
  try {
71278
71294
  const parsed = JSON.parse(plaintext);
71279
71295
  messageType = parsed.type || "message";
71280
- messageText = parsed.text ?? plaintext;
71296
+ messageText = envelopeText(parsed, plaintext);
71281
71297
  } catch {
71282
71298
  messageType = "message";
71283
71299
  messageText = plaintext;
@@ -71876,7 +71892,7 @@ ${baseText}`;
71876
71892
  try {
71877
71893
  const parsed = JSON.parse(plaintext);
71878
71894
  messageType = parsed.type || "message";
71879
- messageText = parsed.text ?? plaintext;
71895
+ messageText = envelopeText(parsed, plaintext);
71880
71896
  } catch {
71881
71897
  messageType = "message";
71882
71898
  messageText = plaintext;
@@ -72161,7 +72177,7 @@ ${baseText}`;
72161
72177
  try {
72162
72178
  const parsed = JSON.parse(plaintext);
72163
72179
  messageType = parsed.type || "message";
72164
- messageText = parsed.text ?? plaintext;
72180
+ messageText = envelopeText(parsed, plaintext);
72165
72181
  } catch {
72166
72182
  messageType = "message";
72167
72183
  messageText = plaintext;
@@ -99300,7 +99316,7 @@ var init_index = __esm({
99300
99316
  await init_skill_telemetry();
99301
99317
  await init_policy_enforcer();
99302
99318
  init_room_protocol();
99303
- VERSION = true ? "0.23.43" : "0.0.0-dev";
99319
+ VERSION = true ? "0.23.44" : "0.0.0-dev";
99304
99320
  }
99305
99321
  });
99306
99322
  await init_index();