@nekzus/liop 2.4.0-alpha.24 → 2.4.0-alpha.26

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.
Files changed (109) hide show
  1. package/README.md +21 -10
  2. package/dist/bin/agent.js +27 -932
  3. package/dist/bridge.d.ts +3 -3
  4. package/dist/bridge.js +1 -5
  5. package/dist/chunk-2XHSALII.js +3 -0
  6. package/dist/chunk-2ZYX736J.js +2 -0
  7. package/dist/chunk-3WRKTVOF.js +2 -0
  8. package/dist/chunk-6KFKO6ZX.js +2 -0
  9. package/dist/chunk-6VK2XALI.js +2 -0
  10. package/dist/chunk-AYDF3IFZ.js +2 -0
  11. package/dist/chunk-CTTTLCGL.js +31 -0
  12. package/dist/chunk-ECRS6N33.js +4 -0
  13. package/dist/chunk-FDJMH4CB.js +2 -0
  14. package/dist/chunk-FTF6AMF6.js +0 -1
  15. package/dist/chunk-GWVSCZUS.js +2 -0
  16. package/dist/chunk-LEXMMIQI.js +15 -0
  17. package/dist/chunk-LM26HOJ6.js +31 -0
  18. package/dist/chunk-MQ5SU26J.js +2 -0
  19. package/dist/chunk-N35BC62H.js +2 -0
  20. package/dist/chunk-P6IJ3VBD.js +3 -0
  21. package/dist/chunk-TKLRW52V.js +2 -0
  22. package/dist/chunk-V35CXJQN.js +2 -0
  23. package/dist/chunk-WP5ER7RH.js +3 -0
  24. package/dist/chunk-XLVEDKM6.js +2 -0
  25. package/dist/chunk-Y675R34Z.js +2 -0
  26. package/dist/chunk-YD2AF2M6.js +46 -0
  27. package/dist/chunk-YLCNV764.js +3 -0
  28. package/dist/chunk-ZZMSFCJP.js +3 -0
  29. package/dist/client.d.ts +4 -4
  30. package/dist/client.js +1 -12
  31. package/dist/gateway.d.ts +5 -5
  32. package/dist/gateway.js +1 -12
  33. package/dist/{hybrid-Cb95yJFg.d.ts → hybrid-BZpCiUaV.d.ts} +3 -3
  34. package/dist/{index-DtovobWb.d.ts → index-BYDtRGue.d.ts} +3 -3
  35. package/dist/{index-D2P6Z_hP.d.ts → index-ByzjpRCk.d.ts} +6 -1
  36. package/dist/index.d.ts +15 -10
  37. package/dist/index.js +4 -319
  38. package/dist/kyber-PULV7PQX.js +2 -0
  39. package/dist/mesh.js +1 -5
  40. package/dist/server.d.ts +3 -3
  41. package/dist/server.js +1 -9
  42. package/dist/{types-rxL19f0l.d.ts → types-29zv9X1V.d.ts} +1 -1
  43. package/dist/types.d.ts +2 -2
  44. package/dist/types.js +1 -3
  45. package/dist/{verifier-EgKmGrh7.d.ts → verifier-DqZ9MQ9l.d.ts} +34 -5
  46. package/dist/verifier-J4NQYZX5.js +2 -0
  47. package/dist/workers/logic-execution.d.ts +2 -1
  48. package/dist/workers/logic-execution.js +1 -326
  49. package/dist/workers/zk-verifier.d.ts +1 -1
  50. package/dist/workers/zk-verifier.js +1 -245
  51. package/dist/{zk-CYImPsa6.d.ts → zk-DzYNWBgo.d.ts} +14 -1
  52. package/package.json +6 -2
  53. package/dist/bin/agent.js.map +0 -1
  54. package/dist/bridge.js.map +0 -1
  55. package/dist/chunk-2VQS2XRH.js +0 -564
  56. package/dist/chunk-2VQS2XRH.js.map +0 -1
  57. package/dist/chunk-3QH44NKZ.js +0 -115
  58. package/dist/chunk-3QH44NKZ.js.map +0 -1
  59. package/dist/chunk-53QKIQNF.js +0 -818
  60. package/dist/chunk-53QKIQNF.js.map +0 -1
  61. package/dist/chunk-7BSCUYUE.js +0 -421
  62. package/dist/chunk-7BSCUYUE.js.map +0 -1
  63. package/dist/chunk-7PITYWOV.js +0 -68
  64. package/dist/chunk-7PITYWOV.js.map +0 -1
  65. package/dist/chunk-FTF6AMF6.js.map +0 -1
  66. package/dist/chunk-GFGSHQN5.js +0 -206884
  67. package/dist/chunk-GFGSHQN5.js.map +0 -1
  68. package/dist/chunk-IDTXJQBH.js +0 -1506
  69. package/dist/chunk-IDTXJQBH.js.map +0 -1
  70. package/dist/chunk-IHKKWXHJ.js +0 -876
  71. package/dist/chunk-IHKKWXHJ.js.map +0 -1
  72. package/dist/chunk-IK7CGWAZ.js +0 -24
  73. package/dist/chunk-IK7CGWAZ.js.map +0 -1
  74. package/dist/chunk-JWFLXXZS.js +0 -3743
  75. package/dist/chunk-JWFLXXZS.js.map +0 -1
  76. package/dist/chunk-K3DGJLUY.js +0 -106
  77. package/dist/chunk-K3DGJLUY.js.map +0 -1
  78. package/dist/chunk-KR5UZUEY.js +0 -98
  79. package/dist/chunk-KR5UZUEY.js.map +0 -1
  80. package/dist/chunk-OHMZZMMC.js +0 -58
  81. package/dist/chunk-OHMZZMMC.js.map +0 -1
  82. package/dist/chunk-P34HDRN5.js +0 -213
  83. package/dist/chunk-P34HDRN5.js.map +0 -1
  84. package/dist/chunk-Q3FKHJ3B.js +0 -345
  85. package/dist/chunk-Q3FKHJ3B.js.map +0 -1
  86. package/dist/chunk-V47P2AQR.js +0 -281
  87. package/dist/chunk-V47P2AQR.js.map +0 -1
  88. package/dist/chunk-WPTOJYN5.js +0 -181
  89. package/dist/chunk-WPTOJYN5.js.map +0 -1
  90. package/dist/chunk-Y62GORQF.js +0 -51
  91. package/dist/chunk-Y62GORQF.js.map +0 -1
  92. package/dist/chunk-ZJGVKM7G.js +0 -803
  93. package/dist/chunk-ZJGVKM7G.js.map +0 -1
  94. package/dist/chunk-ZP3VVXOI.js +0 -66
  95. package/dist/chunk-ZP3VVXOI.js.map +0 -1
  96. package/dist/chunk-ZRWNMP5L.js +0 -165
  97. package/dist/chunk-ZRWNMP5L.js.map +0 -1
  98. package/dist/client.js.map +0 -1
  99. package/dist/gateway.js.map +0 -1
  100. package/dist/index.js.map +0 -1
  101. package/dist/kyber-CGOA7Q6A.js +0 -3
  102. package/dist/kyber-CGOA7Q6A.js.map +0 -1
  103. package/dist/mesh.js.map +0 -1
  104. package/dist/server.js.map +0 -1
  105. package/dist/types.js.map +0 -1
  106. package/dist/verifier-UBJTZQSA.js +0 -6
  107. package/dist/verifier-UBJTZQSA.js.map +0 -1
  108. package/dist/workers/logic-execution.js.map +0 -1
  109. package/dist/workers/zk-verifier.js.map +0 -1
@@ -1,345 +0,0 @@
1
- // src/observability/metrics.ts
2
- function formatLabels(labels) {
3
- if (!labels || Object.keys(labels).length === 0) {
4
- return "";
5
- }
6
- const entries = Object.entries(labels).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => `${k}="${String(v).replace(/"/g, '\\"')}"`);
7
- return `{${entries.join(",")}}`;
8
- }
9
- function labelsToKey(labels) {
10
- if (!labels) return "";
11
- return Object.entries(labels).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => `${k}:${v}`).join("|");
12
- }
13
- var Counter = class {
14
- constructor(name, help) {
15
- this.name = name;
16
- this.help = help;
17
- }
18
- name;
19
- help;
20
- values = /* @__PURE__ */ new Map();
21
- inc(labels, value = 1) {
22
- if (value < 0) {
23
- throw new Error("Counter increments must be non-negative");
24
- }
25
- const key = labelsToKey(labels);
26
- const current = this.values.get(key) || { value: 0, labels };
27
- current.value += value;
28
- this.values.set(key, current);
29
- }
30
- get(labels) {
31
- const key = labelsToKey(labels);
32
- return this.values.get(key)?.value || 0;
33
- }
34
- reset() {
35
- this.values.clear();
36
- }
37
- toPrometheus() {
38
- const lines = [
39
- `# HELP ${this.name} ${this.help}`,
40
- `# TYPE ${this.name} counter`
41
- ];
42
- if (this.values.size === 0) {
43
- lines.push(`${this.name} 0`);
44
- return lines;
45
- }
46
- for (const entry of this.values.values()) {
47
- lines.push(`${this.name}${formatLabels(entry.labels)} ${entry.value}`);
48
- }
49
- return lines;
50
- }
51
- };
52
- var Gauge = class {
53
- constructor(name, help) {
54
- this.name = name;
55
- this.help = help;
56
- }
57
- name;
58
- help;
59
- values = /* @__PURE__ */ new Map();
60
- set(labelsOrValue, maybeValue) {
61
- if (typeof labelsOrValue === "number") {
62
- this.values.set("", { value: labelsOrValue });
63
- return;
64
- }
65
- const labels = labelsOrValue;
66
- const val = typeof maybeValue === "number" ? maybeValue : 0;
67
- const key = labelsToKey(labels);
68
- this.values.set(key, { value: val, labels });
69
- }
70
- inc(labels, value = 1) {
71
- const key = labelsToKey(labels);
72
- const current = this.values.get(key) || { value: 0, labels };
73
- current.value += value;
74
- this.values.set(key, current);
75
- }
76
- dec(labels, value = 1) {
77
- const key = labelsToKey(labels);
78
- const current = this.values.get(key) || { value: 0, labels };
79
- current.value -= value;
80
- this.values.set(key, current);
81
- }
82
- get(labels) {
83
- const key = labelsToKey(labels);
84
- return this.values.get(key)?.value || 0;
85
- }
86
- reset() {
87
- this.values.clear();
88
- }
89
- toPrometheus() {
90
- const lines = [
91
- `# HELP ${this.name} ${this.help}`,
92
- `# TYPE ${this.name} gauge`
93
- ];
94
- if (this.values.size === 0) {
95
- lines.push(`${this.name} 0`);
96
- return lines;
97
- }
98
- for (const entry of this.values.values()) {
99
- lines.push(`${this.name}${formatLabels(entry.labels)} ${entry.value}`);
100
- }
101
- return lines;
102
- }
103
- };
104
- var Histogram = class {
105
- constructor(name, help, buckets = [5, 10, 25, 50, 100, 250, 500, 1e3, 2500, 5e3, 1e4]) {
106
- this.name = name;
107
- this.help = help;
108
- this.buckets = [...buckets].sort((a, b) => a - b);
109
- }
110
- name;
111
- help;
112
- buckets;
113
- observations = /* @__PURE__ */ new Map();
114
- observe(labelsOrValue, maybeValue) {
115
- let labels;
116
- let val;
117
- if (typeof labelsOrValue === "number") {
118
- val = labelsOrValue;
119
- } else {
120
- labels = labelsOrValue;
121
- val = typeof maybeValue === "number" ? maybeValue : 0;
122
- }
123
- const key = labelsToKey(labels);
124
- let state = this.observations.get(key);
125
- if (!state) {
126
- state = {
127
- count: 0,
128
- sum: 0,
129
- bucketCounts: new Map(this.buckets.map((b) => [b, 0])),
130
- labels
131
- };
132
- this.observations.set(key, state);
133
- }
134
- state.count += 1;
135
- state.sum += val;
136
- for (const bound of this.buckets) {
137
- if (val <= bound) {
138
- const cur = state.bucketCounts.get(bound) || 0;
139
- state.bucketCounts.set(bound, cur + 1);
140
- }
141
- }
142
- }
143
- reset() {
144
- this.observations.clear();
145
- }
146
- toPrometheus() {
147
- const lines = [
148
- `# HELP ${this.name} ${this.help}`,
149
- `# TYPE ${this.name} histogram`
150
- ];
151
- if (this.observations.size === 0) {
152
- lines.push(`${this.name}_count 0`);
153
- lines.push(`${this.name}_sum 0`);
154
- return lines;
155
- }
156
- for (const state of this.observations.values()) {
157
- const baseLabels = state.labels || {};
158
- for (const bound of this.buckets) {
159
- const bucketLabels = { ...baseLabels, le: String(bound) };
160
- lines.push(
161
- `${this.name}_bucket${formatLabels(bucketLabels)} ${state.bucketCounts.get(bound) || 0}`
162
- );
163
- }
164
- const infLabels = { ...baseLabels, le: "+Inf" };
165
- lines.push(
166
- `${this.name}_bucket${formatLabels(infLabels)} ${state.count}`
167
- );
168
- lines.push(`${this.name}_sum${formatLabels(baseLabels)} ${state.sum}`);
169
- lines.push(
170
- `${this.name}_count${formatLabels(baseLabels)} ${state.count}`
171
- );
172
- }
173
- return lines;
174
- }
175
- };
176
- var MetricsRegistry = class {
177
- counters = /* @__PURE__ */ new Map();
178
- gauges = /* @__PURE__ */ new Map();
179
- histograms = /* @__PURE__ */ new Map();
180
- counter(name, help) {
181
- let c = this.counters.get(name);
182
- if (!c) {
183
- c = new Counter(name, help);
184
- this.counters.set(name, c);
185
- }
186
- return c;
187
- }
188
- gauge(name, help) {
189
- let g = this.gauges.get(name);
190
- if (!g) {
191
- g = new Gauge(name, help);
192
- this.gauges.set(name, g);
193
- }
194
- return g;
195
- }
196
- histogram(name, help, buckets) {
197
- let h = this.histograms.get(name);
198
- if (!h) {
199
- h = new Histogram(name, help, buckets);
200
- this.histograms.set(name, h);
201
- }
202
- return h;
203
- }
204
- collectProcessMetrics() {
205
- const uptime = this.gauge(
206
- "liop_process_uptime_seconds",
207
- "Process uptime in seconds"
208
- );
209
- uptime.set(Math.floor(process.uptime()));
210
- const health = this.gauge(
211
- "liop_node_health_status",
212
- "Operational health status of the LIOP node (1 = healthy, 0 = degraded)"
213
- );
214
- health.set(1);
215
- if (typeof process.memoryUsage === "function") {
216
- const mem = process.memoryUsage();
217
- const rss = this.gauge(
218
- "liop_process_memory_rss_bytes",
219
- "Resident set size memory in bytes"
220
- );
221
- rss.set(mem.rss);
222
- const heapUsed = this.gauge(
223
- "liop_process_memory_heap_used_bytes",
224
- "Heap memory used in bytes"
225
- );
226
- heapUsed.set(mem.heapUsed);
227
- const heapTotal = this.gauge(
228
- "liop_process_memory_heap_total_bytes",
229
- "Total V8 allocated heap memory in bytes"
230
- );
231
- heapTotal.set(mem.heapTotal);
232
- const external = this.gauge(
233
- "liop_process_memory_external_bytes",
234
- "External memory bound to C++ objects and buffers in bytes"
235
- );
236
- external.set(mem.external);
237
- }
238
- }
239
- exportPrometheusText() {
240
- this.collectProcessMetrics();
241
- const lines = [];
242
- for (const c of this.counters.values()) {
243
- lines.push(...c.toPrometheus());
244
- }
245
- for (const g of this.gauges.values()) {
246
- lines.push(...g.toPrometheus());
247
- }
248
- for (const h of this.histograms.values()) {
249
- lines.push(...h.toPrometheus());
250
- }
251
- lines.push("");
252
- return lines.join("\n");
253
- }
254
- resetAll() {
255
- for (const c of this.counters.values()) c.reset();
256
- for (const g of this.gauges.values()) g.reset();
257
- for (const h of this.histograms.values()) h.reset();
258
- }
259
- };
260
- var protocolMetrics = new MetricsRegistry();
261
- var toolCallsTotal = protocolMetrics.counter(
262
- "liop_tool_calls_total",
263
- "Total number of tool logic-injection executions"
264
- );
265
- var toolCallErrorsTotal = protocolMetrics.counter(
266
- "liop_tool_call_errors_total",
267
- "Total number of failed tool logic-injection executions or policy rejections"
268
- );
269
- var fuelConsumed = protocolMetrics.histogram(
270
- "liop_fuel_consumed_total",
271
- "Deterministic fuel units consumed by injected logic",
272
- [100, 500, 1e3, 2500, 5e3, 1e4, 5e4, 1e5]
273
- );
274
- var meshPeersConnected = protocolMetrics.gauge(
275
- "liop_mesh_peers_connected",
276
- "Active peer connections in the P2P mesh"
277
- );
278
- var manifestCacheSize = protocolMetrics.gauge(
279
- "liop_manifest_cache_size",
280
- "Number of verified remote tool manifests in cache"
281
- );
282
- var egressBlocksTotal = protocolMetrics.counter(
283
- "liop_egress_blocks_total",
284
- "Total number of outputs blocked by Egress Shield"
285
- );
286
- var zkVerificationDurationMs = protocolMetrics.histogram(
287
- "liop_zk_verification_duration_ms",
288
- "Duration of ZK-Receipt and HMAC cryptographic attestation in ms",
289
- [1, 2, 5, 10, 25, 50, 100, 250, 500]
290
- );
291
- var zkVerificationsTotal = protocolMetrics.counter(
292
- "liop_zk_verifications_total",
293
- "Total number of ZK-Receipt cryptographic attestation checks"
294
- );
295
- var zkProofsByTypeTotal = protocolMetrics.counter(
296
- "liop_zk_proofs_by_type_total",
297
- "Total number of verified ZK receipts partitioned by proof type (groth16, hmac)"
298
- );
299
- var zkProvingDurationMs = protocolMetrics.histogram(
300
- "liop_zk_proving_duration_ms",
301
- "Duration of native ZK proof generation in ms",
302
- [10, 25, 50, 100, 250, 500, 1e3, 2500]
303
- );
304
- var zkVkeyCacheSize = protocolMetrics.gauge(
305
- "liop_zk_vkey_cache_size",
306
- "Number of registered verification keys in memory cache"
307
- );
308
- var tokensInputTotal = protocolMetrics.counter(
309
- "liop_tokens_input_total",
310
- "Total BPE input tokens processed by LIOP"
311
- );
312
- var tokensOutputTotal = protocolMetrics.counter(
313
- "liop_tokens_output_total",
314
- "Total BPE output tokens emitted by LIOP"
315
- );
316
- var tokensSavedTotal = protocolMetrics.counter(
317
- "liop_tokens_saved_total",
318
- "Estimated tokens saved compared to MCP context-pulling baseline"
319
- );
320
- var operationDurationMs = protocolMetrics.histogram(
321
- "liop_operation_duration_ms",
322
- "End-to-end operation duration in ms",
323
- [5, 15, 30, 50, 100, 250, 500, 1e3, 2500, 5e3]
324
- );
325
- var pqcHandshakeDurationMs = protocolMetrics.histogram(
326
- "liop_pqc_handshake_duration_ms",
327
- "Duration of ML-KEM-768 post-quantum cryptographic key encapsulation in ms",
328
- [1, 5, 10, 25, 50, 100, 250, 500]
329
- );
330
- var pqcHandshakesTotal = protocolMetrics.counter(
331
- "liop_pqc_handshakes_total",
332
- "Total number of ML-KEM-768 key encapsulation operations"
333
- );
334
- var wireEgressBytesTotal = protocolMetrics.counter(
335
- "liop_wire_egress_bytes_total",
336
- "Total wire egress bytes emitted by logic executions"
337
- );
338
- var wireSavedBytesTotal = protocolMetrics.counter(
339
- "liop_wire_saved_bytes_total",
340
- "Estimated wire egress bytes saved compared to MCP context extraction baseline"
341
- );
342
-
343
- export { Counter, Gauge, Histogram, MetricsRegistry, egressBlocksTotal, fuelConsumed, manifestCacheSize, meshPeersConnected, operationDurationMs, pqcHandshakeDurationMs, pqcHandshakesTotal, protocolMetrics, tokensInputTotal, tokensOutputTotal, tokensSavedTotal, toolCallErrorsTotal, toolCallsTotal, wireEgressBytesTotal, wireSavedBytesTotal, zkProofsByTypeTotal, zkProvingDurationMs, zkVerificationDurationMs, zkVerificationsTotal, zkVkeyCacheSize };
344
- //# sourceMappingURL=chunk-Q3FKHJ3B.js.map
345
- //# sourceMappingURL=chunk-Q3FKHJ3B.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/observability/metrics.ts"],"names":[],"mappings":";AAkBA,SAAS,aAAa,MAAA,EAA+B;AACpD,EAAA,IAAI,CAAC,MAAA,IAAU,MAAA,CAAO,KAAK,MAAM,CAAA,CAAE,WAAW,CAAA,EAAG;AAChD,IAAA,OAAO,EAAA;AAAA,EACR;AACA,EAAA,MAAM,OAAA,GAAU,MAAA,CAAO,OAAA,CAAQ,MAAM,EACnC,IAAA,CAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA,KAAM,CAAA,CAAE,cAAc,CAAC,CAAC,CAAA,CACrC,GAAA,CAAI,CAAC,CAAC,CAAA,EAAG,CAAC,MAAM,CAAA,EAAG,CAAC,CAAA,EAAA,EAAK,MAAA,CAAO,CAAC,CAAA,CAAE,OAAA,CAAQ,IAAA,EAAM,KAAK,CAAC,CAAA,CAAA,CAAG,CAAA;AAC5D,EAAA,OAAO,CAAA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M,oBAAoB,eAAA,CAAgB,OAAA;AAAA,EAChD,0BAAA;AAAA,EACA;AACD;AAEO,IAAM,mBAAmB,eAAA,CAAgB,OAAA;AAAA,EAC/C,yBAAA;AAAA,EACA;AACD;AAEO,IAAM,sBAAsB,eAAA,CAAgB,SAAA;AAAA,EAClD,4BAAA;AAAA,EACA,qCAAA;AAAA,EACA,CAAC,CAAA,EAAG,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,KAAK,GAAA,EAAK,GAAA,EAAK,GAAA,EAAM,IAAA,EAAM,GAAI;AAChD;AAEO,IAAM,yBAAyB,eAAA,CAAgB,SAAA;AAAA,EACrD,gCAAA;AAAA,EACA,2EAAA;AAAA,EACA,CAAC,GAAG,CAAA,EAAG,EAAA,EAAI,IAAI,EAAA,EAAI,GAAA,EAAK,KAAK,GAAG;AACjC;AAEO,IAAM,qBAAqB,eAAA,CAAgB,OAAA;AAAA,EACjD,2BAAA;AAAA,EACA;AACD;AAEO,IAAM,uBAAuB,eAAA,CAAgB,OAAA;AAAA,EACnD,8BAAA;AAAA,EACA;AACD;AAEO,IAAM,sBAAsB,eAAA,CAAgB,OAAA;AAAA,EAClD,6BAAA;AAAA,EACA;AACD","file":"chunk-Q3FKHJ3B.js","sourcesContent":["// Copyright 2026 Nekzus Solutions and contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * LIOP Prometheus Metrics Registry (Phase Beta-3)\n * Lightweight, zero-dependency, high-performance metrics collector\n * complying with Prometheus and OpenMetrics exposition format.\n */\n\nexport type MetricLabels = Record<string, string | number>;\n\nexport interface MetricDefinition {\n\tname: string;\n\thelp: string;\n\ttype: \"counter\" | \"gauge\" | \"histogram\";\n\tbuckets?: number[];\n}\n\nfunction formatLabels(labels?: MetricLabels): string {\n\tif (!labels || Object.keys(labels).length === 0) {\n\t\treturn \"\";\n\t}\n\tconst entries = Object.entries(labels)\n\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t.map(([k, v]) => `${k}=\"${String(v).replace(/\"/g, '\\\\\"')}\"`);\n\treturn `{${entries.join(\",\")}}`;\n}\n\nfunction labelsToKey(labels?: MetricLabels): string {\n\tif (!labels) return \"\";\n\treturn Object.entries(labels)\n\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t.map(([k, v]) => `${k}:${v}`)\n\t\t.join(\"|\");\n}\n\nexport class Counter {\n\tprivate values = new Map<string, { value: number; labels?: MetricLabels }>();\n\n\tconstructor(\n\t\tpublic readonly name: string,\n\t\tpublic readonly help: string,\n\t) {}\n\n\tinc(labels?: MetricLabels, value = 1): void {\n\t\tif (value < 0) {\n\t\t\tthrow new Error(\"Counter increments must be non-negative\");\n\t\t}\n\t\tconst key = labelsToKey(labels);\n\t\tconst current = this.values.get(key) || { value: 0, labels };\n\t\tcurrent.value += value;\n\t\tthis.values.set(key, current);\n\t}\n\n\tget(labels?: MetricLabels): number {\n\t\tconst key = labelsToKey(labels);\n\t\treturn this.values.get(key)?.value || 0;\n\t}\n\n\treset(): void {\n\t\tthis.values.clear();\n\t}\n\n\ttoPrometheus(): string[] {\n\t\tconst lines: string[] = [\n\t\t\t`# HELP ${this.name} ${this.help}`,\n\t\t\t`# TYPE ${this.name} counter`,\n\t\t];\n\t\tif (this.values.size === 0) {\n\t\t\tlines.push(`${this.name} 0`);\n\t\t\treturn lines;\n\t\t}\n\t\tfor (const entry of this.values.values()) {\n\t\t\tlines.push(`${this.name}${formatLabels(entry.labels)} ${entry.value}`);\n\t\t}\n\t\treturn lines;\n\t}\n}\n\nexport class Gauge {\n\tprivate values = new Map<string, { value: number; labels?: MetricLabels }>();\n\n\tconstructor(\n\t\tpublic readonly name: string,\n\t\tpublic readonly help: string,\n\t) {}\n\n\tset(labelsOrValue: MetricLabels | number, maybeValue?: number): void {\n\t\tif (typeof labelsOrValue === \"number\") {\n\t\t\tthis.values.set(\"\", { value: labelsOrValue });\n\t\t\treturn;\n\t\t}\n\t\tconst labels = labelsOrValue;\n\t\tconst val = typeof maybeValue === \"number\" ? maybeValue : 0;\n\t\tconst key = labelsToKey(labels);\n\t\tthis.values.set(key, { value: val, labels });\n\t}\n\n\tinc(labels?: MetricLabels, value = 1): void {\n\t\tconst key = labelsToKey(labels);\n\t\tconst current = this.values.get(key) || { value: 0, labels };\n\t\tcurrent.value += value;\n\t\tthis.values.set(key, current);\n\t}\n\n\tdec(labels?: MetricLabels, value = 1): void {\n\t\tconst key = labelsToKey(labels);\n\t\tconst current = this.values.get(key) || { value: 0, labels };\n\t\tcurrent.value -= value;\n\t\tthis.values.set(key, current);\n\t}\n\n\tget(labels?: MetricLabels): number {\n\t\tconst key = labelsToKey(labels);\n\t\treturn this.values.get(key)?.value || 0;\n\t}\n\n\treset(): void {\n\t\tthis.values.clear();\n\t}\n\n\ttoPrometheus(): string[] {\n\t\tconst lines: string[] = [\n\t\t\t`# HELP ${this.name} ${this.help}`,\n\t\t\t`# TYPE ${this.name} gauge`,\n\t\t];\n\t\tif (this.values.size === 0) {\n\t\t\tlines.push(`${this.name} 0`);\n\t\t\treturn lines;\n\t\t}\n\t\tfor (const entry of this.values.values()) {\n\t\t\tlines.push(`${this.name}${formatLabels(entry.labels)} ${entry.value}`);\n\t\t}\n\t\treturn lines;\n\t}\n}\n\nexport class Histogram {\n\tpublic readonly buckets: number[];\n\tprivate observations = new Map<\n\t\tstring,\n\t\t{\n\t\t\tcount: number;\n\t\t\tsum: number;\n\t\t\tbucketCounts: Map<number, number>;\n\t\t\tlabels?: MetricLabels;\n\t\t}\n\t>();\n\n\tconstructor(\n\t\tpublic readonly name: string,\n\t\tpublic readonly help: string,\n\t\tbuckets: number[] = [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],\n\t) {\n\t\tthis.buckets = [...buckets].sort((a, b) => a - b);\n\t}\n\n\tobserve(labelsOrValue: MetricLabels | number, maybeValue?: number): void {\n\t\tlet labels: MetricLabels | undefined;\n\t\tlet val: number;\n\n\t\tif (typeof labelsOrValue === \"number\") {\n\t\t\tval = labelsOrValue;\n\t\t} else {\n\t\t\tlabels = labelsOrValue;\n\t\t\tval = typeof maybeValue === \"number\" ? maybeValue : 0;\n\t\t}\n\n\t\tconst key = labelsToKey(labels);\n\t\tlet state = this.observations.get(key);\n\t\tif (!state) {\n\t\t\tstate = {\n\t\t\t\tcount: 0,\n\t\t\t\tsum: 0,\n\t\t\t\tbucketCounts: new Map(this.buckets.map((b) => [b, 0])),\n\t\t\t\tlabels,\n\t\t\t};\n\t\t\tthis.observations.set(key, state);\n\t\t}\n\n\t\tstate.count += 1;\n\t\tstate.sum += val;\n\n\t\tfor (const bound of this.buckets) {\n\t\t\tif (val <= bound) {\n\t\t\t\tconst cur = state.bucketCounts.get(bound) || 0;\n\t\t\t\tstate.bucketCounts.set(bound, cur + 1);\n\t\t\t}\n\t\t}\n\t}\n\n\treset(): void {\n\t\tthis.observations.clear();\n\t}\n\n\ttoPrometheus(): string[] {\n\t\tconst lines: string[] = [\n\t\t\t`# HELP ${this.name} ${this.help}`,\n\t\t\t`# TYPE ${this.name} histogram`,\n\t\t];\n\t\tif (this.observations.size === 0) {\n\t\t\tlines.push(`${this.name}_count 0`);\n\t\t\tlines.push(`${this.name}_sum 0`);\n\t\t\treturn lines;\n\t\t}\n\n\t\tfor (const state of this.observations.values()) {\n\t\t\tconst baseLabels = state.labels || {};\n\t\t\tfor (const bound of this.buckets) {\n\t\t\t\tconst bucketLabels = { ...baseLabels, le: String(bound) };\n\t\t\t\tlines.push(\n\t\t\t\t\t`${this.name}_bucket${formatLabels(bucketLabels)} ${state.bucketCounts.get(bound) || 0}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst infLabels = { ...baseLabels, le: \"+Inf\" };\n\t\t\tlines.push(\n\t\t\t\t`${this.name}_bucket${formatLabels(infLabels)} ${state.count}`,\n\t\t\t);\n\t\t\tlines.push(`${this.name}_sum${formatLabels(baseLabels)} ${state.sum}`);\n\t\t\tlines.push(\n\t\t\t\t`${this.name}_count${formatLabels(baseLabels)} ${state.count}`,\n\t\t\t);\n\t\t}\n\t\treturn lines;\n\t}\n}\n\nexport class MetricsRegistry {\n\tprivate counters = new Map<string, Counter>();\n\tprivate gauges = new Map<string, Gauge>();\n\tprivate histograms = new Map<string, Histogram>();\n\n\tcounter(name: string, help: string): Counter {\n\t\tlet c = this.counters.get(name);\n\t\tif (!c) {\n\t\t\tc = new Counter(name, help);\n\t\t\tthis.counters.set(name, c);\n\t\t}\n\t\treturn c;\n\t}\n\n\tgauge(name: string, help: string): Gauge {\n\t\tlet g = this.gauges.get(name);\n\t\tif (!g) {\n\t\t\tg = new Gauge(name, help);\n\t\t\tthis.gauges.set(name, g);\n\t\t}\n\t\treturn g;\n\t}\n\n\thistogram(name: string, help: string, buckets?: number[]): Histogram {\n\t\tlet h = this.histograms.get(name);\n\t\tif (!h) {\n\t\t\th = new Histogram(name, help, buckets);\n\t\t\tthis.histograms.set(name, h);\n\t\t}\n\t\treturn h;\n\t}\n\n\tcollectProcessMetrics(): void {\n\t\tconst uptime = this.gauge(\n\t\t\t\"liop_process_uptime_seconds\",\n\t\t\t\"Process uptime in seconds\",\n\t\t);\n\t\tuptime.set(Math.floor(process.uptime()));\n\n\t\tconst health = this.gauge(\n\t\t\t\"liop_node_health_status\",\n\t\t\t\"Operational health status of the LIOP node (1 = healthy, 0 = degraded)\",\n\t\t);\n\t\thealth.set(1);\n\n\t\tif (typeof process.memoryUsage === \"function\") {\n\t\t\tconst mem = process.memoryUsage();\n\t\t\tconst rss = this.gauge(\n\t\t\t\t\"liop_process_memory_rss_bytes\",\n\t\t\t\t\"Resident set size memory in bytes\",\n\t\t\t);\n\t\t\trss.set(mem.rss);\n\n\t\t\tconst heapUsed = this.gauge(\n\t\t\t\t\"liop_process_memory_heap_used_bytes\",\n\t\t\t\t\"Heap memory used in bytes\",\n\t\t\t);\n\t\t\theapUsed.set(mem.heapUsed);\n\n\t\t\tconst heapTotal = this.gauge(\n\t\t\t\t\"liop_process_memory_heap_total_bytes\",\n\t\t\t\t\"Total V8 allocated heap memory in bytes\",\n\t\t\t);\n\t\t\theapTotal.set(mem.heapTotal);\n\n\t\t\tconst external = this.gauge(\n\t\t\t\t\"liop_process_memory_external_bytes\",\n\t\t\t\t\"External memory bound to C++ objects and buffers in bytes\",\n\t\t\t);\n\t\t\texternal.set(mem.external);\n\t\t}\n\t}\n\n\texportPrometheusText(): string {\n\t\tthis.collectProcessMetrics();\n\n\t\tconst lines: string[] = [];\n\t\tfor (const c of this.counters.values()) {\n\t\t\tlines.push(...c.toPrometheus());\n\t\t}\n\t\tfor (const g of this.gauges.values()) {\n\t\t\tlines.push(...g.toPrometheus());\n\t\t}\n\t\tfor (const h of this.histograms.values()) {\n\t\t\tlines.push(...h.toPrometheus());\n\t\t}\n\t\tlines.push(\"\"); // Trailing newline\n\t\treturn lines.join(\"\\n\");\n\t}\n\n\tresetAll(): void {\n\t\tfor (const c of this.counters.values()) c.reset();\n\t\tfor (const g of this.gauges.values()) g.reset();\n\t\tfor (const h of this.histograms.values()) h.reset();\n\t}\n}\n\n// ── Global Standard Protocol Metrics Instance ──────────────────────────────────\n\nexport const protocolMetrics = new MetricsRegistry();\n\nexport const toolCallsTotal = protocolMetrics.counter(\n\t\"liop_tool_calls_total\",\n\t\"Total number of tool logic-injection executions\",\n);\n\nexport const toolCallErrorsTotal = protocolMetrics.counter(\n\t\"liop_tool_call_errors_total\",\n\t\"Total number of failed tool logic-injection executions or policy rejections\",\n);\n\nexport const fuelConsumed = protocolMetrics.histogram(\n\t\"liop_fuel_consumed_total\",\n\t\"Deterministic fuel units consumed by injected logic\",\n\t[100, 500, 1000, 2500, 5000, 10000, 50000, 100000],\n);\n\nexport const meshPeersConnected = protocolMetrics.gauge(\n\t\"liop_mesh_peers_connected\",\n\t\"Active peer connections in the P2P mesh\",\n);\n\nexport const manifestCacheSize = protocolMetrics.gauge(\n\t\"liop_manifest_cache_size\",\n\t\"Number of verified remote tool manifests in cache\",\n);\n\nexport const egressBlocksTotal = protocolMetrics.counter(\n\t\"liop_egress_blocks_total\",\n\t\"Total number of outputs blocked by Egress Shield\",\n);\n\nexport const zkVerificationDurationMs = protocolMetrics.histogram(\n\t\"liop_zk_verification_duration_ms\",\n\t\"Duration of ZK-Receipt and HMAC cryptographic attestation in ms\",\n\t[1, 2, 5, 10, 25, 50, 100, 250, 500],\n);\n\nexport const zkVerificationsTotal = protocolMetrics.counter(\n\t\"liop_zk_verifications_total\",\n\t\"Total number of ZK-Receipt cryptographic attestation checks\",\n);\n\nexport const zkProofsByTypeTotal = protocolMetrics.counter(\n\t\"liop_zk_proofs_by_type_total\",\n\t\"Total number of verified ZK receipts partitioned by proof type (groth16, hmac)\",\n);\n\nexport const zkProvingDurationMs = protocolMetrics.histogram(\n\t\"liop_zk_proving_duration_ms\",\n\t\"Duration of native ZK proof generation in ms\",\n\t[10, 25, 50, 100, 250, 500, 1000, 2500],\n);\n\nexport const zkVkeyCacheSize = protocolMetrics.gauge(\n\t\"liop_zk_vkey_cache_size\",\n\t\"Number of registered verification keys in memory cache\",\n);\n\nexport const tokensInputTotal = protocolMetrics.counter(\n\t\"liop_tokens_input_total\",\n\t\"Total BPE input tokens processed by LIOP\",\n);\n\nexport const tokensOutputTotal = protocolMetrics.counter(\n\t\"liop_tokens_output_total\",\n\t\"Total BPE output tokens emitted by LIOP\",\n);\n\nexport const tokensSavedTotal = protocolMetrics.counter(\n\t\"liop_tokens_saved_total\",\n\t\"Estimated tokens saved compared to MCP context-pulling baseline\",\n);\n\nexport const operationDurationMs = protocolMetrics.histogram(\n\t\"liop_operation_duration_ms\",\n\t\"End-to-end operation duration in ms\",\n\t[5, 15, 30, 50, 100, 250, 500, 1000, 2500, 5000],\n);\n\nexport const pqcHandshakeDurationMs = protocolMetrics.histogram(\n\t\"liop_pqc_handshake_duration_ms\",\n\t\"Duration of ML-KEM-768 post-quantum cryptographic key encapsulation in ms\",\n\t[1, 5, 10, 25, 50, 100, 250, 500],\n);\n\nexport const pqcHandshakesTotal = protocolMetrics.counter(\n\t\"liop_pqc_handshakes_total\",\n\t\"Total number of ML-KEM-768 key encapsulation operations\",\n);\n\nexport const wireEgressBytesTotal = protocolMetrics.counter(\n\t\"liop_wire_egress_bytes_total\",\n\t\"Total wire egress bytes emitted by logic executions\",\n);\n\nexport const wireSavedBytesTotal = protocolMetrics.counter(\n\t\"liop_wire_saved_bytes_total\",\n\t\"Estimated wire egress bytes saved compared to MCP context extraction baseline\",\n);\n"]}
@@ -1,281 +0,0 @@
1
- import { TOOL_ALIASES } from './chunk-KR5UZUEY.js';
2
- import { log } from './chunk-K3DGJLUY.js';
3
-
4
- // src/runtime/routing-table.ts
5
- var RoutingTable = class _RoutingTable {
6
- routes = /* @__PURE__ */ new Map();
7
- static MAX_FAILURES = 5;
8
- /**
9
- * Registers or updates a collection of tools exposed via an HTTP Gateway.
10
- */
11
- registerGatewayTools(tools, mcpEndpoint, authRequired = true) {
12
- for (const tool of tools) {
13
- const existing = this.routes.get(tool.name);
14
- this.routes.set(tool.name, {
15
- name: tool.name,
16
- provider: "http-gateway",
17
- endpoint: mcpEndpoint,
18
- description: tool.description ?? existing?.description,
19
- inputSchema: tool.inputSchema ?? existing?.inputSchema,
20
- latencyMs: existing?.latencyMs ?? 0,
21
- failCount: 0,
22
- lastSuccess: existing?.lastSuccess ?? Date.now(),
23
- authRequired
24
- });
25
- }
26
- log.info(
27
- `[RoutingTable] Registered ${tools.length} tool(s) via HTTP Gateway (${mcpEndpoint})`
28
- );
29
- }
30
- /**
31
- * Registers tools discovered directly over the P2P Mesh (gRPC).
32
- */
33
- registerMeshTools(tools, grpcTarget, authRequired = false) {
34
- for (const tool of tools) {
35
- const existing = this.routes.get(tool.name);
36
- if (existing && existing.provider === "http-gateway" && existing.failCount === 0) {
37
- continue;
38
- }
39
- this.routes.set(tool.name, {
40
- name: tool.name,
41
- provider: "p2p-grpc",
42
- endpoint: grpcTarget,
43
- description: tool.description ?? existing?.description,
44
- inputSchema: tool.inputSchema ?? existing?.inputSchema,
45
- latencyMs: existing?.latencyMs ?? 0,
46
- failCount: 0,
47
- lastSuccess: existing?.lastSuccess ?? Date.now(),
48
- authRequired
49
- });
50
- }
51
- log.info(
52
- `[RoutingTable] Registered ${tools.length} tool(s) via P2P Mesh gRPC (${grpcTarget})`
53
- );
54
- }
55
- /**
56
- * Registers an in-process local tool (e.g. LiopMeshStatus).
57
- */
58
- registerLocalTool(tool) {
59
- this.routes.set(tool.name, {
60
- name: tool.name,
61
- provider: "local",
62
- endpoint: "in-process",
63
- description: tool.description,
64
- inputSchema: tool.inputSchema,
65
- latencyMs: 0,
66
- failCount: 0,
67
- lastSuccess: Date.now(),
68
- authRequired: false
69
- });
70
- }
71
- /**
72
- * Resolves the optimal route for a specific tool.
73
- */
74
- resolve(toolName) {
75
- const targetName = TOOL_ALIASES[toolName] || toolName;
76
- const route = this.routes.get(targetName) ?? this.routes.get(toolName);
77
- if (!route) return void 0;
78
- if (route.failCount >= _RoutingTable.MAX_FAILURES) {
79
- log.warn(
80
- `[RoutingTable] Tool '${toolName}' route has tripped circuit breaker (${route.failCount} consecutive failures).`
81
- );
82
- }
83
- return route;
84
- }
85
- /**
86
- * Records a successful invocation on a route, resetting failures and updating latency.
87
- */
88
- recordSuccess(toolName, latencyMs) {
89
- const route = this.routes.get(toolName);
90
- if (route) {
91
- route.failCount = 0;
92
- route.latencyMs = latencyMs;
93
- route.lastSuccess = Date.now();
94
- }
95
- }
96
- /**
97
- * Records a failed invocation on a route.
98
- */
99
- recordFailure(toolName) {
100
- const route = this.routes.get(toolName);
101
- if (route) {
102
- route.failCount += 1;
103
- log.warn(
104
- `[RoutingTable] Failure recorded for tool '${toolName}' (failCount: ${route.failCount})`
105
- );
106
- }
107
- }
108
- /**
109
- * Lists all registered tools in sorted format for tools/list.
110
- */
111
- getAllToolDefinitions() {
112
- const list = [];
113
- for (const route of this.routes.values()) {
114
- list.push({
115
- name: route.name,
116
- description: route.description,
117
- inputSchema: route.inputSchema
118
- });
119
- }
120
- return list.sort((a, b) => a.name.localeCompare(b.name));
121
- }
122
- getRoute(toolName) {
123
- return this.routes.get(toolName);
124
- }
125
- size() {
126
- return this.routes.size;
127
- }
128
- clear() {
129
- this.routes.clear();
130
- }
131
- };
132
-
133
- // src/runtime/topology-probe.ts
134
- async function probeGatewayUrl(candidateUrl, options) {
135
- const trimmedUrl = candidateUrl.replace(/\/+$/, "");
136
- const healthUrl = `${trimmedUrl}/health`;
137
- try {
138
- log.info(`[TopologyProbe] Probing candidate Gateway at: ${healthUrl}`);
139
- const healthRes = await fetch(healthUrl, {
140
- headers: { Accept: "application/json" },
141
- signal: AbortSignal.timeout(3e3)
142
- });
143
- if (!healthRes.ok) {
144
- log.info(
145
- `[TopologyProbe] Probe failed at ${healthUrl} [HTTP ${healthRes.status}]`
146
- );
147
- return null;
148
- }
149
- const healthData = await healthRes.json();
150
- if (healthData.status !== "healthy") {
151
- return null;
152
- }
153
- let issuer = healthData.auth?.issuer || "";
154
- let tokenEndpoint = healthData.auth?.token_endpoint || "";
155
- let audience = options.audience || "urn:liop:mesh:api";
156
- let scopes = [
157
- "liop:tools:list",
158
- "liop:tools:call",
159
- "liop:resources:read",
160
- "liop:schema:read",
161
- "liop:mesh:query"
162
- ];
163
- try {
164
- const prmUrl = `${trimmedUrl}/.well-known/oauth-protected-resource`;
165
- const prmRes = await fetch(prmUrl, {
166
- headers: { Accept: "application/json" },
167
- signal: AbortSignal.timeout(2e3)
168
- });
169
- if (prmRes.ok) {
170
- const prmData = await prmRes.json();
171
- if (prmData.resource) audience = prmData.resource;
172
- if (prmData.authorization_servers?.length) {
173
- issuer = prmData.authorization_servers[0];
174
- }
175
- if (prmData.scopes_supported?.length) {
176
- scopes = prmData.scopes_supported;
177
- }
178
- }
179
- } catch {
180
- }
181
- if (!tokenEndpoint && issuer) {
182
- const baseIssuer = issuer.endsWith("/oidc") ? issuer : `${issuer}/oidc`;
183
- tokenEndpoint = `${baseIssuer}/token`;
184
- }
185
- if (tokenEndpoint) {
186
- try {
187
- const parsedEndpoint = new URL(tokenEndpoint);
188
- if (options.nexusUrl) {
189
- const nexusBase = options.nexusUrl.replace(/\/+$/, "");
190
- const nexusHost = new URL(nexusBase).host;
191
- parsedEndpoint.host = nexusHost;
192
- tokenEndpoint = parsedEndpoint.toString();
193
- } else if ((parsedEndpoint.hostname === "nexus" || parsedEndpoint.hostname === "nexus-prod" || parsedEndpoint.hostname.startsWith("172.")) && trimmedUrl.includes("127.0.0.1")) {
194
- parsedEndpoint.host = "127.0.0.1:15000";
195
- tokenEndpoint = parsedEndpoint.toString();
196
- }
197
- } catch {
198
- }
199
- }
200
- log.info(
201
- `[TopologyProbe] \u2705 Verified Gateway at ${trimmedUrl} (Tools: ${healthData.tools?.length ?? 0}, Tier: ${healthData.topology?.tier ?? 2})`
202
- );
203
- return {
204
- baseUrl: trimmedUrl,
205
- mcpEndpoint: `${trimmedUrl}/mcp`,
206
- healthEndpoint: `${trimmedUrl}/health`,
207
- tokenEndpoint,
208
- issuer,
209
- audience,
210
- scopes,
211
- tools: healthData.tools || [],
212
- tier: healthData.topology?.tier ?? 2
213
- };
214
- } catch (err) {
215
- log.info(
216
- `[TopologyProbe] Gateway probe unreachable at ${trimmedUrl}: ${err instanceof Error ? err.message : String(err)}`
217
- );
218
- return null;
219
- }
220
- }
221
- async function probeTopology(options = {}) {
222
- log.info("[TopologyProbe] Starting adaptive network topology discovery...");
223
- let gatewayInfo = null;
224
- if (options.blgUrl) {
225
- gatewayInfo = await probeGatewayUrl(options.blgUrl, options);
226
- }
227
- if (!gatewayInfo && (options.autoProbeLocal ?? true)) {
228
- const candidateUrls = [
229
- "http://127.0.0.1:15018",
230
- // Production BLG port
231
- "http://127.0.0.1:15000",
232
- // Production Nexus port
233
- "http://127.0.0.1:13000"
234
- // Demo Nexus port
235
- ];
236
- for (const url of candidateUrls) {
237
- if (options.blgUrl && url.includes(new URL(options.blgUrl).port))
238
- continue;
239
- gatewayInfo = await probeGatewayUrl(url, options);
240
- if (gatewayInfo) break;
241
- }
242
- }
243
- const bootstrapNodes = options.bootstrapNodes || [];
244
- const hasMeshBootstraps = bootstrapNodes.length > 0;
245
- if (gatewayInfo && hasMeshBootstraps) {
246
- log.info(
247
- `[TopologyProbe] \u26A1 Mode Determined: HYBRID (Gateway: ${gatewayInfo.baseUrl} + ${bootstrapNodes.length} P2P bootstraps)`
248
- );
249
- return {
250
- mode: "hybrid",
251
- gateway: gatewayInfo,
252
- mesh: {
253
- bootstrapNodes,
254
- identityPath: options.identityPath
255
- }
256
- };
257
- }
258
- if (gatewayInfo) {
259
- log.info(
260
- `[TopologyProbe] \u{1F680} Mode Determined: GATEWAY (Zero-P2P overhead, direct to ${gatewayInfo.baseUrl})`
261
- );
262
- return {
263
- mode: "gateway",
264
- gateway: gatewayInfo
265
- };
266
- }
267
- log.info(
268
- `[TopologyProbe] \u{1F310} Mode Determined: MESH (Standard P2P DHT, Bootstraps: ${bootstrapNodes.length})`
269
- );
270
- return {
271
- mode: "mesh",
272
- mesh: {
273
- bootstrapNodes,
274
- identityPath: options.identityPath
275
- }
276
- };
277
- }
278
-
279
- export { RoutingTable, probeTopology };
280
- //# sourceMappingURL=chunk-V47P2AQR.js.map
281
- //# sourceMappingURL=chunk-V47P2AQR.js.map