blue-js-sdk 2.0.0

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 (215) hide show
  1. package/CHANGELOG.md +446 -0
  2. package/LICENSE +21 -0
  3. package/README.md +75 -0
  4. package/ai-path/ADMIN-ELEVATION.md +116 -0
  5. package/ai-path/AI-MANIFESTO.md +185 -0
  6. package/ai-path/BREAKING.md +74 -0
  7. package/ai-path/CHECKLIST.md +619 -0
  8. package/ai-path/CONNECTION-STEPS.md +724 -0
  9. package/ai-path/DECISION-TREE.md +378 -0
  10. package/ai-path/DEPENDENCIES.md +459 -0
  11. package/ai-path/E2E-FLOW.md +1555 -0
  12. package/ai-path/FAILURES.md +403 -0
  13. package/ai-path/GUIDE.md +1217 -0
  14. package/ai-path/README.md +558 -0
  15. package/ai-path/SPLIT-TUNNEL.md +266 -0
  16. package/ai-path/cli.js +535 -0
  17. package/ai-path/connect.js +884 -0
  18. package/ai-path/discover.js +178 -0
  19. package/ai-path/environment.js +266 -0
  20. package/ai-path/errors.js +86 -0
  21. package/ai-path/examples/autonomous-agent.mjs +220 -0
  22. package/ai-path/examples/multi-region.mjs +174 -0
  23. package/ai-path/examples/one-shot.mjs +31 -0
  24. package/ai-path/index.js +60 -0
  25. package/ai-path/pricing.js +136 -0
  26. package/ai-path/recommend.js +413 -0
  27. package/ai-path/run-admin.vbs +25 -0
  28. package/ai-path/setup.js +291 -0
  29. package/ai-path/wallet.js +137 -0
  30. package/app-helpers.js +363 -0
  31. package/app-settings.js +95 -0
  32. package/app-types.js +267 -0
  33. package/audit.js +847 -0
  34. package/batch.js +293 -0
  35. package/bin/setup.js +376 -0
  36. package/chain/authz.js +109 -0
  37. package/chain/broadcast.js +472 -0
  38. package/chain/client.js +160 -0
  39. package/chain/fee-grants.js +305 -0
  40. package/chain/index.js +891 -0
  41. package/chain/lcd.js +313 -0
  42. package/chain/queries.js +547 -0
  43. package/chain/rpc.js +408 -0
  44. package/chain/wallet.js +141 -0
  45. package/cli/config.js +143 -0
  46. package/cli/index.js +463 -0
  47. package/cli/output.js +182 -0
  48. package/cli.js +491 -0
  49. package/client/index.js +251 -0
  50. package/client.js +271 -0
  51. package/config/index.js +255 -0
  52. package/connection/connect.js +849 -0
  53. package/connection/disconnect.js +180 -0
  54. package/connection/discovery.js +321 -0
  55. package/connection/index.js +76 -0
  56. package/connection/proxy.js +148 -0
  57. package/connection/resilience.js +428 -0
  58. package/connection/security.js +232 -0
  59. package/connection/state.js +369 -0
  60. package/connection/tunnel.js +691 -0
  61. package/consumer.js +132 -0
  62. package/cosmjs-setup.js +1884 -0
  63. package/defaults.js +366 -0
  64. package/disk-cache.js +107 -0
  65. package/dist/client.d.ts +108 -0
  66. package/dist/client.d.ts.map +1 -0
  67. package/dist/client.js +400 -0
  68. package/dist/client.js.map +1 -0
  69. package/dist/index.d.ts +8 -0
  70. package/dist/index.d.ts.map +1 -0
  71. package/dist/index.js +8 -0
  72. package/dist/index.js.map +1 -0
  73. package/errors/index.js +112 -0
  74. package/errors.js +218 -0
  75. package/examples/README.md +64 -0
  76. package/examples/connect-direct.mjs +106 -0
  77. package/examples/connect-plan.mjs +125 -0
  78. package/examples/error-handling.mjs +109 -0
  79. package/examples/query-nodes.mjs +94 -0
  80. package/examples/wallet-basics.mjs +61 -0
  81. package/generated/amino/amino.ts +9 -0
  82. package/generated/cosmos/base/v1beta1/coin.ts +365 -0
  83. package/generated/cosmos_proto/cosmos.ts +323 -0
  84. package/generated/gogoproto/gogo.ts +9 -0
  85. package/generated/google/protobuf/descriptor.ts +7601 -0
  86. package/generated/google/protobuf/duration.ts +208 -0
  87. package/generated/google/protobuf/timestamp.ts +238 -0
  88. package/generated/sentinel/lease/v1/events.ts +924 -0
  89. package/generated/sentinel/lease/v1/lease.ts +292 -0
  90. package/generated/sentinel/lease/v1/msg.ts +949 -0
  91. package/generated/sentinel/lease/v1/params.ts +164 -0
  92. package/generated/sentinel/node/v3/events.ts +881 -0
  93. package/generated/sentinel/node/v3/msg.ts +1002 -0
  94. package/generated/sentinel/node/v3/node.ts +263 -0
  95. package/generated/sentinel/node/v3/params.ts +183 -0
  96. package/generated/sentinel/plan/v3/events.ts +675 -0
  97. package/generated/sentinel/plan/v3/msg.ts +1191 -0
  98. package/generated/sentinel/plan/v3/plan.ts +283 -0
  99. package/generated/sentinel/provider/v2/events.ts +171 -0
  100. package/generated/sentinel/provider/v2/msg.ts +480 -0
  101. package/generated/sentinel/provider/v2/params.ts +131 -0
  102. package/generated/sentinel/provider/v2/provider.ts +246 -0
  103. package/generated/sentinel/session/v3/events.ts +480 -0
  104. package/generated/sentinel/session/v3/msg.ts +616 -0
  105. package/generated/sentinel/session/v3/params.ts +260 -0
  106. package/generated/sentinel/session/v3/proof.ts +180 -0
  107. package/generated/sentinel/session/v3/session.ts +384 -0
  108. package/generated/sentinel/subscription/v3/events.ts +1181 -0
  109. package/generated/sentinel/subscription/v3/msg.ts +1305 -0
  110. package/generated/sentinel/subscription/v3/params.ts +167 -0
  111. package/generated/sentinel/subscription/v3/subscription.ts +315 -0
  112. package/generated/sentinel/types/v1/bandwidth.ts +124 -0
  113. package/generated/sentinel/types/v1/price.ts +149 -0
  114. package/generated/sentinel/types/v1/renewal.ts +87 -0
  115. package/generated/sentinel/types/v1/status.ts +54 -0
  116. package/generated/typeRegistry.ts +27 -0
  117. package/index.js +486 -0
  118. package/node-connect.js +3015 -0
  119. package/operator.js +134 -0
  120. package/package.json +113 -0
  121. package/plan-operations.js +199 -0
  122. package/preflight.js +352 -0
  123. package/pricing/index.js +262 -0
  124. package/proto/amino/amino.proto +84 -0
  125. package/proto/cosmos/base/v1beta1/coin.proto +61 -0
  126. package/proto/cosmos_proto/cosmos.proto +112 -0
  127. package/proto/gogoproto/gogo.proto +145 -0
  128. package/proto/google/api/annotations.proto +31 -0
  129. package/proto/google/api/http.proto +370 -0
  130. package/proto/google/protobuf/any.proto +106 -0
  131. package/proto/google/protobuf/duration.proto +115 -0
  132. package/proto/google/protobuf/timestamp.proto +145 -0
  133. package/proto/sentinel/lease/v1/events.proto +52 -0
  134. package/proto/sentinel/lease/v1/genesis.proto +15 -0
  135. package/proto/sentinel/lease/v1/lease.proto +25 -0
  136. package/proto/sentinel/lease/v1/msg.proto +62 -0
  137. package/proto/sentinel/lease/v1/params.proto +17 -0
  138. package/proto/sentinel/node/v3/events.proto +50 -0
  139. package/proto/sentinel/node/v3/genesis.proto +15 -0
  140. package/proto/sentinel/node/v3/msg.proto +63 -0
  141. package/proto/sentinel/node/v3/node.proto +27 -0
  142. package/proto/sentinel/node/v3/params.proto +21 -0
  143. package/proto/sentinel/node/v3/querier.proto +63 -0
  144. package/proto/sentinel/plan/v3/events.proto +41 -0
  145. package/proto/sentinel/plan/v3/genesis.proto +21 -0
  146. package/proto/sentinel/plan/v3/msg.proto +83 -0
  147. package/proto/sentinel/plan/v3/plan.proto +32 -0
  148. package/proto/sentinel/plan/v3/querier.proto +53 -0
  149. package/proto/sentinel/provider/v2/events.proto +16 -0
  150. package/proto/sentinel/provider/v2/genesis.proto +15 -0
  151. package/proto/sentinel/provider/v2/msg.proto +35 -0
  152. package/proto/sentinel/provider/v2/params.proto +17 -0
  153. package/proto/sentinel/provider/v2/provider.proto +24 -0
  154. package/proto/sentinel/provider/v3/genesis.proto +15 -0
  155. package/proto/sentinel/provider/v3/params.proto +13 -0
  156. package/proto/sentinel/session/v3/events.proto +30 -0
  157. package/proto/sentinel/session/v3/genesis.proto +15 -0
  158. package/proto/sentinel/session/v3/msg.proto +50 -0
  159. package/proto/sentinel/session/v3/params.proto +25 -0
  160. package/proto/sentinel/session/v3/proof.proto +25 -0
  161. package/proto/sentinel/session/v3/querier.proto +100 -0
  162. package/proto/sentinel/session/v3/session.proto +50 -0
  163. package/proto/sentinel/subscription/v2/allocation.proto +21 -0
  164. package/proto/sentinel/subscription/v2/payout.proto +22 -0
  165. package/proto/sentinel/subscription/v3/events.proto +65 -0
  166. package/proto/sentinel/subscription/v3/genesis.proto +17 -0
  167. package/proto/sentinel/subscription/v3/msg.proto +83 -0
  168. package/proto/sentinel/subscription/v3/params.proto +21 -0
  169. package/proto/sentinel/subscription/v3/subscription.proto +33 -0
  170. package/proto/sentinel/types/v1/bandwidth.proto +19 -0
  171. package/proto/sentinel/types/v1/price.proto +21 -0
  172. package/proto/sentinel/types/v1/renewal.proto +21 -0
  173. package/proto/sentinel/types/v1/status.proto +16 -0
  174. package/protocol/encoding.js +341 -0
  175. package/protocol/events.js +361 -0
  176. package/protocol/handshake.js +297 -0
  177. package/protocol/index.js +15 -0
  178. package/protocol/messages.js +346 -0
  179. package/protocol/plans.js +199 -0
  180. package/protocol/v2ray.js +268 -0
  181. package/protocol/v3.js +723 -0
  182. package/protocol/wireguard.js +125 -0
  183. package/security/index.js +132 -0
  184. package/session-manager.js +329 -0
  185. package/session-tracker.js +80 -0
  186. package/setup.js +376 -0
  187. package/speedtest/index.js +528 -0
  188. package/speedtest.js +567 -0
  189. package/src/client.ts +502 -0
  190. package/src/index.ts +20 -0
  191. package/state/index.js +347 -0
  192. package/state.js +516 -0
  193. package/test-all-chain-ops.js +493 -0
  194. package/test-all-logic.js +199 -0
  195. package/test-all-msg-types.js +292 -0
  196. package/test-every-connection.js +208 -0
  197. package/test-feegrant-connect.js +98 -0
  198. package/test-logic.js +148 -0
  199. package/test-mainnet.js +176 -0
  200. package/test-plan-lifecycle.js +335 -0
  201. package/tls-trust.js +132 -0
  202. package/tsconfig.build.json +20 -0
  203. package/tsconfig.json +34 -0
  204. package/types/chain.d.ts +746 -0
  205. package/types/connection.d.ts +425 -0
  206. package/types/errors.d.ts +174 -0
  207. package/types/index.d.ts +1380 -0
  208. package/types/nodes.d.ts +187 -0
  209. package/types/pricing.d.ts +156 -0
  210. package/types/protocol.d.ts +332 -0
  211. package/types/session.d.ts +236 -0
  212. package/types/settings.d.ts +192 -0
  213. package/v3protocol.js +1053 -0
  214. package/wallet/index.js +153 -0
  215. package/wireguard.js +307 -0
package/index.js ADDED
@@ -0,0 +1,486 @@
1
+ /**
2
+ * Sentinel dVPN SDK — Single Entry Point
3
+ *
4
+ * 160+ exports (+ dryRun option on connect functions) — import everything from one place:
5
+ * import { connect, disconnect, listNodes } from './index.js';
6
+ *
7
+ * Or import specific modules:
8
+ * import { createWallet, broadcast } from './index.js';
9
+ */
10
+
11
+ // Ensure axios uses Node.js HTTP adapter (prevents opaque "fetch failed" on Node 18+)
12
+ import axios from 'axios';
13
+ axios.defaults.adapter = 'http';
14
+
15
+ // ─── High-level API (use these for quick apps) ──────────────────────────────
16
+
17
+ export {
18
+ connectDirect as connect,
19
+ connectDirect,
20
+ connectViaPlan,
21
+ connectViaSubscription,
22
+ connectAuto,
23
+ isConnecting,
24
+ queryOnlineNodes as listNodes,
25
+ queryOnlineNodes,
26
+ fetchAllNodes,
27
+ enrichNodes,
28
+ buildNodeIndex,
29
+ disconnect,
30
+ isConnected,
31
+ getStatus,
32
+ registerCleanupHandlers,
33
+ setSystemProxy,
34
+ clearSystemProxy,
35
+ checkPortFree,
36
+ resetCircuitBreaker,
37
+ configureCircuitBreaker,
38
+ getCircuitBreakerStatus,
39
+ clearWalletCache,
40
+ flushNodeCache,
41
+ recoverSession,
42
+ getConnectionMetrics,
43
+ createConnectConfig,
44
+ quickConnect,
45
+ autoReconnect,
46
+ verifyConnection,
47
+ verifyDependencies,
48
+ enableKillSwitch,
49
+ disableKillSwitch,
50
+ isKillSwitchEnabled,
51
+ enableDnsLeakPrevention,
52
+ disableDnsLeakPrevention,
53
+ events,
54
+ ConnectionState,
55
+ disconnectState,
56
+ tryFastReconnect,
57
+ } from './node-connect.js';
58
+
59
+ // ─── Wallet & Chain ─────────────────────────────────────────────────────────
60
+
61
+ export {
62
+ createWallet,
63
+ generateWallet,
64
+ privKeyFromMnemonic,
65
+ createClient,
66
+ broadcast,
67
+ broadcastWithFeeGrant,
68
+ createSafeBroadcaster,
69
+ extractId,
70
+ parseChainError,
71
+ getBalance,
72
+ isMnemonicValid,
73
+ getNodePrices,
74
+ getNetworkOverview,
75
+ formatDvpn,
76
+ formatP2P,
77
+ filterNodes,
78
+ serializeResult,
79
+ getDvpnPrice,
80
+ findExistingSession,
81
+ fetchActiveNodes,
82
+ discoverPlanIds,
83
+ resolveNodeUrl,
84
+ sentToSentprov,
85
+ sentToSentnode,
86
+ sentprovToSent,
87
+ buildRegistry,
88
+ lcd,
89
+ txResponse,
90
+ MSG_TYPES,
91
+ // FeeGrant
92
+ buildFeeGrantMsg,
93
+ buildRevokeFeeGrantMsg,
94
+ queryFeeGrants,
95
+ queryFeeGrant,
96
+ // Authz
97
+ buildAuthzGrantMsg,
98
+ buildAuthzRevokeMsg,
99
+ buildAuthzExecMsg,
100
+ encodeForExec,
101
+ queryAuthzGrants,
102
+ // LCD Query Helpers (v25b)
103
+ lcdQuery,
104
+ lcdQueryAll,
105
+ // Plan Subscriber Helpers (v25b)
106
+ queryPlanSubscribers,
107
+ getPlanStats,
108
+ // Fee Grant Workflow (v25b)
109
+ grantPlanSubscribers,
110
+ queryFeeGrantsIssued,
111
+ getExpiringGrants,
112
+ renewExpiringGrants,
113
+ monitorFeeGrants,
114
+ // Missing functionality (v25c)
115
+ querySubscriptions,
116
+ querySessionAllocation,
117
+ queryNode,
118
+ buildBatchStartSession,
119
+ buildEndSessionMsg,
120
+ // v26: Field experience helpers
121
+ queryPlanNodes,
122
+ discoverPlans,
123
+ shortAddress,
124
+ formatSubscriptionExpiry,
125
+ sendTokens,
126
+ subscribeToPlan,
127
+ getProviderByAddress,
128
+ buildBatchSend,
129
+ buildBatchLink,
130
+ decodeTxEvents,
131
+ extractAllSessionIds,
132
+ estimateBatchFee,
133
+ estimateSessionCost,
134
+ isSameKey,
135
+ // v26c: Defensive pagination + queries
136
+ lcdPaginatedSafe,
137
+ querySessions,
138
+ querySubscription,
139
+ hasActiveSubscription,
140
+ // v26c: Display helpers
141
+ formatBytes,
142
+ parseChainDuration,
143
+ flattenSession,
144
+ // v27: VPN Settings Persistence
145
+ loadVpnSettings,
146
+ saveVpnSettings,
147
+ } from './cosmjs-setup.js';
148
+
149
+ // ─── Protocol (handshakes, configs, tunnels) ─────────────────────────────────
150
+
151
+ export {
152
+ nodeStatusV3,
153
+ generateWgKeyPair,
154
+ initHandshakeV3,
155
+ initHandshakeV3V2Ray,
156
+ writeWgConfig,
157
+ buildV2RayClientConfig,
158
+ generateV2RayUUID,
159
+ extractSessionId,
160
+ waitForPort,
161
+ validateCIDR,
162
+ } from './v3protocol.js';
163
+
164
+ // ─── WireGuard (Cross-Platform) ─────────────────────────────────────────────
165
+
166
+ export {
167
+ installWgTunnel,
168
+ uninstallWgTunnel,
169
+ connectWireGuard,
170
+ disconnectWireGuard,
171
+ emergencyCleanupSync,
172
+ watchdogCheck,
173
+ IS_ADMIN,
174
+ WG_EXE,
175
+ WG_QUICK,
176
+ WG_AVAILABLE,
177
+ } from './wireguard.js';
178
+
179
+ // ─── Speed Testing ──────────────────────────────────────────────────────────
180
+
181
+ export {
182
+ speedtestDirect,
183
+ speedtestViaSocks5,
184
+ resolveSpeedtestIPs,
185
+ flushSpeedTestDnsCache,
186
+ compareSpeedTests,
187
+ SPEEDTEST_DEFAULTS,
188
+ } from './speedtest.js';
189
+
190
+ // ─── Plan & Provider Management ─────────────────────────────────────────────
191
+
192
+ export {
193
+ encodeMsgRegisterProvider,
194
+ encodeMsgUpdateProviderDetails,
195
+ encodeMsgUpdateProviderStatus,
196
+ encodeMsgCreatePlan,
197
+ encodeMsgUpdatePlanStatus,
198
+ encodeMsgLinkNode,
199
+ encodeMsgUnlinkNode,
200
+ encodeMsgPlanStartSession,
201
+ encodeMsgStartLease,
202
+ encodeMsgEndLease,
203
+ encodePrice,
204
+ encodeDuration,
205
+ decToScaledInt,
206
+ } from './plan-operations.js';
207
+
208
+ // ─── Session Message Encoders (direct/sub sessions) ─────────────────────────
209
+
210
+ export {
211
+ encodeMsgStartSession,
212
+ encodeMsgEndSession,
213
+ encodeMsgStartSubscription,
214
+ encodeMsgSubStartSession,
215
+ // Subscription management (v3)
216
+ encodeMsgCancelSubscription,
217
+ encodeMsgRenewSubscription,
218
+ encodeMsgShareSubscription,
219
+ encodeMsgUpdateSubscription,
220
+ // Session management (v3)
221
+ encodeMsgUpdateSession,
222
+ // Node operator (v3)
223
+ encodeMsgRegisterNode,
224
+ encodeMsgUpdateNodeDetails,
225
+ encodeMsgUpdateNodeStatus,
226
+ // Plan details update (v3)
227
+ encodeMsgUpdatePlanDetails,
228
+ // EncodeObject builders (return { typeUrl, value } for signAndBroadcast)
229
+ buildMsgStartSession,
230
+ buildMsgEndSession,
231
+ buildMsgStartSubscription,
232
+ buildMsgSubStartSession,
233
+ buildMsgCancelSubscription,
234
+ buildMsgRenewSubscription,
235
+ buildMsgShareSubscription,
236
+ buildMsgUpdateSubscription,
237
+ buildMsgUpdateSession,
238
+ } from './v3protocol.js';
239
+
240
+ // ─── Typed Message Builders (return { typeUrl, value } EncodeObject) ────────
241
+ // These are the RECOMMENDED way to build messages for signAndBroadcast.
242
+ // The encodeMsg* functions above return raw Uint8Array (for internal/advanced use).
243
+
244
+ export {
245
+ TYPE_URLS,
246
+ buildMsgStartSession as buildMsg_StartSession,
247
+ buildMsgCancelSession,
248
+ buildMsgEndSession as buildMsg_EndSession,
249
+ buildMsgUpdateSession as buildMsg_UpdateSession,
250
+ buildMsgStartSubscription as buildMsg_StartSubscription,
251
+ buildMsgSubStartSession as buildMsg_SubStartSession,
252
+ buildMsgCancelSubscription as buildMsg_CancelSubscription,
253
+ buildMsgRenewSubscription as buildMsg_RenewSubscription,
254
+ buildMsgShareSubscription as buildMsg_ShareSubscription,
255
+ buildMsgUpdateSubscription as buildMsg_UpdateSubscription,
256
+ buildMsgPlanStartSession as buildMsg_PlanStartSession,
257
+ buildMsgCreatePlan as buildMsg_CreatePlan,
258
+ buildMsgUpdatePlanDetails as buildMsg_UpdatePlanDetails,
259
+ buildMsgUpdatePlanStatus as buildMsg_UpdatePlanStatus,
260
+ buildMsgLinkNode as buildMsg_LinkNode,
261
+ buildMsgUnlinkNode as buildMsg_UnlinkNode,
262
+ buildMsgRegisterProvider as buildMsg_RegisterProvider,
263
+ buildMsgUpdateProviderDetails as buildMsg_UpdateProviderDetails,
264
+ buildMsgUpdateProviderStatus as buildMsg_UpdateProviderStatus,
265
+ buildMsgStartLease as buildMsg_StartLease,
266
+ buildMsgEndLease as buildMsg_EndLease,
267
+ buildMsgRegisterNode as buildMsg_RegisterNode,
268
+ buildMsgUpdateNodeDetails as buildMsg_UpdateNodeDetails,
269
+ buildMsgUpdateNodeStatus as buildMsg_UpdateNodeStatus,
270
+ } from './protocol/messages.js';
271
+
272
+ // ─── Typed Event Parsers ────────────────────────────────────────────────────
273
+
274
+ export {
275
+ searchEvent,
276
+ searchEvents,
277
+ extractSessionIdTyped,
278
+ NodeEventCreateSession,
279
+ NodeEventPay,
280
+ NodeEventRefund,
281
+ NodeEventUpdateStatus,
282
+ SessionEventEnd,
283
+ SessionEventUpdateDetails,
284
+ SubscriptionEventCreate,
285
+ SubscriptionEventCreateSession,
286
+ SubscriptionEventPay,
287
+ SubscriptionEventEnd,
288
+ LeaseEventCreate,
289
+ LeaseEventEnd,
290
+ } from './protocol/events.js';
291
+
292
+ // ─── RPC Queries (protobuf via CosmJS — 912x faster than LCD) ───────────────
293
+
294
+ export {
295
+ createRpcQueryClient,
296
+ createRpcQueryClientWithFallback,
297
+ disconnectRpc,
298
+ rpcQueryNodes,
299
+ rpcQueryNode,
300
+ rpcQueryNodesForPlan,
301
+ rpcQuerySessionsForAccount,
302
+ rpcQuerySubscriptionsForAccount,
303
+ rpcQueryPlan,
304
+ rpcQueryBalance,
305
+ } from './chain/rpc.js';
306
+
307
+ // ─── TypeScript Client (extends CosmJS SigningStargateClient) ───────────────
308
+
309
+ export {
310
+ BlueSentinelClient,
311
+ SentinelQueryClient,
312
+ SentinelWsClient,
313
+ } from './dist/index.js';
314
+
315
+ // ─── State Persistence (crash recovery) ─────────────────────────────────────
316
+
317
+ export {
318
+ saveState,
319
+ loadState,
320
+ clearState,
321
+ recoverOrphans,
322
+ markSessionPoisoned,
323
+ markSessionActive,
324
+ isSessionPoisoned,
325
+ getSessionHistory,
326
+ writePidFile,
327
+ checkPidFile,
328
+ clearPidFile,
329
+ saveCredentials,
330
+ loadCredentials,
331
+ clearCredentials,
332
+ clearAllCredentials,
333
+ } from './state.js';
334
+
335
+ // ─── Hardcoded Defaults & Fallback ──────────────────────────────────────────
336
+ // Static values verified 2026-03-08. Will be replaced by live RPC query server.
337
+
338
+ export {
339
+ SDK_VERSION,
340
+ LAST_VERIFIED,
341
+ HARDCODED_NOTE,
342
+ CHAIN_ID,
343
+ CHAIN_VERSION,
344
+ COSMOS_SDK_VERSION,
345
+ DENOM,
346
+ GAS_PRICE,
347
+ DEFAULT_RPC,
348
+ DEFAULT_LCD,
349
+ RPC_ENDPOINTS,
350
+ LCD_ENDPOINTS,
351
+ V2RAY_VERSION,
352
+ TRANSPORT_SUCCESS_RATES,
353
+ BROKEN_NODES,
354
+ PRICING_REFERENCE,
355
+ DEFAULT_TIMEOUTS,
356
+ tryWithFallback,
357
+ checkEndpointHealth,
358
+ sleep,
359
+ bytesToMbps,
360
+ // Dynamic transport rates
361
+ recordTransportResult,
362
+ getDynamicRate,
363
+ getDynamicRates,
364
+ resetDynamicRates,
365
+ // DNS presets
366
+ DNS_PRESETS,
367
+ DEFAULT_DNS_PRESET,
368
+ DNS_FALLBACK_ORDER,
369
+ resolveDnsServers,
370
+ } from './defaults.js';
371
+
372
+ // ─── Typed Errors ────────────────────────────────────────────────────────────
373
+
374
+ export {
375
+ SentinelError,
376
+ ValidationError,
377
+ NodeError,
378
+ ChainError,
379
+ TunnelError,
380
+ SecurityError,
381
+ ErrorCodes,
382
+ ERROR_SEVERITY,
383
+ isRetryable,
384
+ userMessage,
385
+ } from './errors.js';
386
+
387
+ // ─── TLS Trust (TOFU) ───────────────────────────────────────────────────────
388
+
389
+ export {
390
+ createNodeHttpsAgent,
391
+ clearKnownNode,
392
+ clearAllKnownNodes,
393
+ getKnownNode,
394
+ publicEndpointAgent,
395
+ } from './tls-trust.js';
396
+
397
+ // ─── Session Manager ─────────────────────────────────────────────────────────
398
+
399
+ export { SessionManager } from './session-manager.js';
400
+
401
+ // ─── Batch Session Operations ────────────────────────────────────────────────
402
+
403
+ export {
404
+ batchStartSessions,
405
+ waitForBatchSessions,
406
+ waitForSessionActive,
407
+ } from './batch.js';
408
+
409
+ // ─── Pre-Flight System Check ─────────────────────────────────────────────────
410
+
411
+ export {
412
+ preflight,
413
+ checkOrphanedTunnels,
414
+ cleanOrphanedTunnels,
415
+ checkOrphanedV2Ray,
416
+ checkVpnConflicts,
417
+ checkPortConflicts,
418
+ } from './preflight.js';
419
+
420
+ // ─── Cache & Persistence ─────────────────────────────────────────────────────
421
+
422
+ export {
423
+ cached,
424
+ cacheInvalidate,
425
+ cacheClear,
426
+ cacheInfo,
427
+ diskSave,
428
+ diskLoad,
429
+ diskClear,
430
+ } from './disk-cache.js';
431
+
432
+ export {
433
+ trackSession,
434
+ getSessionMode,
435
+ getAllTrackedSessions,
436
+ clearSessionMode,
437
+ } from './session-tracker.js';
438
+
439
+ export {
440
+ loadAppSettings,
441
+ saveAppSettings,
442
+ resetAppSettings,
443
+ APP_SETTINGS_DEFAULTS,
444
+ } from './app-settings.js';
445
+
446
+ // ─── App Types & Builder Helpers ─────────────────────────────────────────────
447
+
448
+ export {
449
+ APP_TYPES,
450
+ APP_TYPE_CONFIG,
451
+ validateAppConfig,
452
+ getConnectDefaults,
453
+ } from './app-types.js';
454
+
455
+ export {
456
+ COUNTRY_MAP,
457
+ countryNameToCode,
458
+ getFlagUrl,
459
+ getFlagEmoji,
460
+ formatPriceP2P,
461
+ formatNodePricing,
462
+ estimateSessionPrice,
463
+ buildNodeDisplay,
464
+ groupNodesByCountry,
465
+ HOUR_OPTIONS,
466
+ GB_OPTIONS,
467
+ formatUptime,
468
+ computeSessionAllocation,
469
+ } from './app-helpers.js';
470
+
471
+ // ─── Instantiable Client Class ───────────────────────────────────────────────
472
+
473
+ export { SentinelClient } from './client.js';
474
+
475
+ // ─── Network Audit & Node Testing ───────────────────────────────────────────
476
+
477
+ export {
478
+ testNode,
479
+ auditNetwork,
480
+ loadTransportCache,
481
+ saveTransportCache,
482
+ recordTransportSuccess,
483
+ recordTransportFailure,
484
+ reorderOutbounds,
485
+ getCacheStats,
486
+ } from './audit.js';