@securecoms/agent-bridge 0.24.0 → 0.25.1

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.
@@ -33,11 +33,17 @@
33
33
  * second warm-up, not a shortcut.
34
34
  *
35
35
  * ⛔ 2. DO NOT IMPORT `libsodium-wrappers-sumo` DIRECTLY HERE. ⇒ THIS ONE STILL
36
- * BINDS ON THIS FILE, UNCHANGED. `esbuild.config.mjs:15` inlines every
37
- * `@agentvault/connect-*` workspace package into the bridge bundle and that
38
- * specifier is absent from the EXTERNAL list at `:3-8`, so esbuild would bundle
39
- * a SECOND libsodium instance out of this file. The await would then warm a
40
- * heap that nothing reads, and this fix would look correct and do nothing.
36
+ * BINDS ON THIS FILE. Before #895 that specifier was absent from the EXTERNAL
37
+ * list in `esbuild.config.mjs`, so esbuild would have bundled a SECOND
38
+ * libsodium instance out of this file: the await would warm a heap that
39
+ * nothing reads, and the fix would look correct and do nothing. #895 inlines
40
+ * the patched `@agentvault/crypto` and makes `libsodium-wrappers-sumo` EXTERNAL
41
+ * precisely so the process keeps ONE instance, shared by the inlined crypto
42
+ * and anything else. ⛔ That singleton is now carried by the EXTERNAL entry;
43
+ * removing it from that list re-creates the split heap. `scripts/pack-smoke.sh`
44
+ * G-5b proves it on the installed tarball: the warm-up below, which only
45
+ * touches the INLINED crypto, must warm the libsodium the installed tree
46
+ * resolves.
41
47
  * ⚠️ The same inlining is why the delegate below is not a no-op in the shipped
42
48
  * bundle: the SDK barrier is inlined into `dist/bin.js` exactly once, and this
43
49
  * delegate points at that one copy.
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const BRIDGE_VERSION = "0.24.0";
1
+ export declare const BRIDGE_VERSION = "0.25.1";
@@ -64,6 +64,9 @@
64
64
  * behind a 2^attempts × 5 s backoff. A nack fails only its own message.
65
65
  * Messages never handed over (mid-flush close, a failed frame write) go
66
66
  * back without that penalty.
67
+ * - #842: a delivery still un-acked after INFLIGHT_STALE_AFTER_MS is LOGGED
68
+ * once (`runtime_inbox.inflight_stale`) and otherwise left alone. There
69
+ * is deliberately no lease: see INFLIGHT_STALE_AFTER_MS.
67
70
  *
68
71
  * Single consumer: the daemon serves one agent per process. A new `/v1/ws`
69
72
  * connection replaces the prior one (newest wins, mirroring the SSE path); the
@@ -77,7 +80,24 @@ import type { BridgeAgent } from "./bridge-agent.js";
77
80
  export interface AgentWebSocketOptions {
78
81
  token: string;
79
82
  allowOrigins: string[];
83
+ /** Test seam: the stale-in-flight sweep period (default INFLIGHT_STALE_SWEEP_MS). */
84
+ inflightStaleSweepMs?: number;
85
+ /** Test seam: the age past which an un-acked delivery is logged (default INFLIGHT_STALE_AFTER_MS). */
86
+ inflightStaleAfterMs?: number;
87
+ /** Test seam: the clock the delivery ages are measured on. */
88
+ now?: () => number;
80
89
  }
90
+ /**
91
+ * FB-P1-024 / #842 ruling §3: a stale-in-flight OBSERVATION, not a lease.
92
+ * The bridge cannot tell a message queued inside the consumer from one whose
93
+ * turn is running, so it must not requeue or cancel on age: a lease short
94
+ * enough to matter would re-run live turns (duplicate replies and side
95
+ * effects). It only logs `runtime_inbox.inflight_stale`, once per delivery,
96
+ * content-free, and takes NO action. The post-launch fix is protocol v2
97
+ * (`started` / `cancel` negotiated in `hello`), not a shorter threshold here.
98
+ */
99
+ export declare const INFLIGHT_STALE_SWEEP_MS = 60000;
100
+ export declare const INFLIGHT_STALE_AFTER_MS: number;
81
101
  export declare function attachAgentWebSocket(server: HttpServer, agent: BridgeAgent, opts: AgentWebSocketOptions): {
82
102
  close(): void;
83
103
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@securecoms/agent-bridge",
3
- "version": "0.24.0",
3
+ "version": "0.25.1",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.5.0"
@@ -37,17 +37,24 @@
37
37
  "test:watch": "vitest"
38
38
  },
39
39
  "dependencies": {
40
- "@agentvault/crypto": "0.4.1",
40
+ "@hpke/chacha20poly1305": "^1.8.0",
41
+ "@hpke/core": "^1.8.0",
42
+ "@hpke/dhkem-x448": "^1.8.0",
43
+ "@hpke/hybridkem-x-wing": "^0.7.0",
44
+ "@hpke/ml-kem": "^0.3.0",
41
45
  "@noble/ciphers": "^1.3.0",
42
46
  "@noble/curves": "^1.9.7",
43
47
  "@noble/hashes": "^1.4.0",
48
+ "@noble/post-quantum": "^0.6.0",
44
49
  "ajv": "^8.18.0",
45
50
  "ajv-formats": "^3.0.1",
51
+ "libsodium-wrappers-sumo": "0.7.15",
46
52
  "ws": "^8.21.0",
47
53
  "zod": "^3.23.0"
48
54
  },
49
55
  "devDependencies": {
50
56
  "@agentvault/connect-core": "*",
57
+ "@agentvault/crypto": "0.4.1",
51
58
  "@types/node": "^22.0.0",
52
59
  "@types/ws": "^8.18.1",
53
60
  "esbuild": "0.24.0",