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.
- package/CHANGELOG.md +446 -0
- package/LICENSE +21 -0
- package/README.md +75 -0
- package/ai-path/ADMIN-ELEVATION.md +116 -0
- package/ai-path/AI-MANIFESTO.md +185 -0
- package/ai-path/BREAKING.md +74 -0
- package/ai-path/CHECKLIST.md +619 -0
- package/ai-path/CONNECTION-STEPS.md +724 -0
- package/ai-path/DECISION-TREE.md +378 -0
- package/ai-path/DEPENDENCIES.md +459 -0
- package/ai-path/E2E-FLOW.md +1555 -0
- package/ai-path/FAILURES.md +403 -0
- package/ai-path/GUIDE.md +1217 -0
- package/ai-path/README.md +558 -0
- package/ai-path/SPLIT-TUNNEL.md +266 -0
- package/ai-path/cli.js +535 -0
- package/ai-path/connect.js +884 -0
- package/ai-path/discover.js +178 -0
- package/ai-path/environment.js +266 -0
- package/ai-path/errors.js +86 -0
- package/ai-path/examples/autonomous-agent.mjs +220 -0
- package/ai-path/examples/multi-region.mjs +174 -0
- package/ai-path/examples/one-shot.mjs +31 -0
- package/ai-path/index.js +60 -0
- package/ai-path/pricing.js +136 -0
- package/ai-path/recommend.js +413 -0
- package/ai-path/run-admin.vbs +25 -0
- package/ai-path/setup.js +291 -0
- package/ai-path/wallet.js +137 -0
- package/app-helpers.js +363 -0
- package/app-settings.js +95 -0
- package/app-types.js +267 -0
- package/audit.js +847 -0
- package/batch.js +293 -0
- package/bin/setup.js +376 -0
- package/chain/authz.js +109 -0
- package/chain/broadcast.js +472 -0
- package/chain/client.js +160 -0
- package/chain/fee-grants.js +305 -0
- package/chain/index.js +891 -0
- package/chain/lcd.js +313 -0
- package/chain/queries.js +547 -0
- package/chain/rpc.js +408 -0
- package/chain/wallet.js +141 -0
- package/cli/config.js +143 -0
- package/cli/index.js +463 -0
- package/cli/output.js +182 -0
- package/cli.js +491 -0
- package/client/index.js +251 -0
- package/client.js +271 -0
- package/config/index.js +255 -0
- package/connection/connect.js +849 -0
- package/connection/disconnect.js +180 -0
- package/connection/discovery.js +321 -0
- package/connection/index.js +76 -0
- package/connection/proxy.js +148 -0
- package/connection/resilience.js +428 -0
- package/connection/security.js +232 -0
- package/connection/state.js +369 -0
- package/connection/tunnel.js +691 -0
- package/consumer.js +132 -0
- package/cosmjs-setup.js +1884 -0
- package/defaults.js +366 -0
- package/disk-cache.js +107 -0
- package/dist/client.d.ts +108 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +400 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/errors/index.js +112 -0
- package/errors.js +218 -0
- package/examples/README.md +64 -0
- package/examples/connect-direct.mjs +106 -0
- package/examples/connect-plan.mjs +125 -0
- package/examples/error-handling.mjs +109 -0
- package/examples/query-nodes.mjs +94 -0
- package/examples/wallet-basics.mjs +61 -0
- package/generated/amino/amino.ts +9 -0
- package/generated/cosmos/base/v1beta1/coin.ts +365 -0
- package/generated/cosmos_proto/cosmos.ts +323 -0
- package/generated/gogoproto/gogo.ts +9 -0
- package/generated/google/protobuf/descriptor.ts +7601 -0
- package/generated/google/protobuf/duration.ts +208 -0
- package/generated/google/protobuf/timestamp.ts +238 -0
- package/generated/sentinel/lease/v1/events.ts +924 -0
- package/generated/sentinel/lease/v1/lease.ts +292 -0
- package/generated/sentinel/lease/v1/msg.ts +949 -0
- package/generated/sentinel/lease/v1/params.ts +164 -0
- package/generated/sentinel/node/v3/events.ts +881 -0
- package/generated/sentinel/node/v3/msg.ts +1002 -0
- package/generated/sentinel/node/v3/node.ts +263 -0
- package/generated/sentinel/node/v3/params.ts +183 -0
- package/generated/sentinel/plan/v3/events.ts +675 -0
- package/generated/sentinel/plan/v3/msg.ts +1191 -0
- package/generated/sentinel/plan/v3/plan.ts +283 -0
- package/generated/sentinel/provider/v2/events.ts +171 -0
- package/generated/sentinel/provider/v2/msg.ts +480 -0
- package/generated/sentinel/provider/v2/params.ts +131 -0
- package/generated/sentinel/provider/v2/provider.ts +246 -0
- package/generated/sentinel/session/v3/events.ts +480 -0
- package/generated/sentinel/session/v3/msg.ts +616 -0
- package/generated/sentinel/session/v3/params.ts +260 -0
- package/generated/sentinel/session/v3/proof.ts +180 -0
- package/generated/sentinel/session/v3/session.ts +384 -0
- package/generated/sentinel/subscription/v3/events.ts +1181 -0
- package/generated/sentinel/subscription/v3/msg.ts +1305 -0
- package/generated/sentinel/subscription/v3/params.ts +167 -0
- package/generated/sentinel/subscription/v3/subscription.ts +315 -0
- package/generated/sentinel/types/v1/bandwidth.ts +124 -0
- package/generated/sentinel/types/v1/price.ts +149 -0
- package/generated/sentinel/types/v1/renewal.ts +87 -0
- package/generated/sentinel/types/v1/status.ts +54 -0
- package/generated/typeRegistry.ts +27 -0
- package/index.js +486 -0
- package/node-connect.js +3015 -0
- package/operator.js +134 -0
- package/package.json +113 -0
- package/plan-operations.js +199 -0
- package/preflight.js +352 -0
- package/pricing/index.js +262 -0
- package/proto/amino/amino.proto +84 -0
- package/proto/cosmos/base/v1beta1/coin.proto +61 -0
- package/proto/cosmos_proto/cosmos.proto +112 -0
- package/proto/gogoproto/gogo.proto +145 -0
- package/proto/google/api/annotations.proto +31 -0
- package/proto/google/api/http.proto +370 -0
- package/proto/google/protobuf/any.proto +106 -0
- package/proto/google/protobuf/duration.proto +115 -0
- package/proto/google/protobuf/timestamp.proto +145 -0
- package/proto/sentinel/lease/v1/events.proto +52 -0
- package/proto/sentinel/lease/v1/genesis.proto +15 -0
- package/proto/sentinel/lease/v1/lease.proto +25 -0
- package/proto/sentinel/lease/v1/msg.proto +62 -0
- package/proto/sentinel/lease/v1/params.proto +17 -0
- package/proto/sentinel/node/v3/events.proto +50 -0
- package/proto/sentinel/node/v3/genesis.proto +15 -0
- package/proto/sentinel/node/v3/msg.proto +63 -0
- package/proto/sentinel/node/v3/node.proto +27 -0
- package/proto/sentinel/node/v3/params.proto +21 -0
- package/proto/sentinel/node/v3/querier.proto +63 -0
- package/proto/sentinel/plan/v3/events.proto +41 -0
- package/proto/sentinel/plan/v3/genesis.proto +21 -0
- package/proto/sentinel/plan/v3/msg.proto +83 -0
- package/proto/sentinel/plan/v3/plan.proto +32 -0
- package/proto/sentinel/plan/v3/querier.proto +53 -0
- package/proto/sentinel/provider/v2/events.proto +16 -0
- package/proto/sentinel/provider/v2/genesis.proto +15 -0
- package/proto/sentinel/provider/v2/msg.proto +35 -0
- package/proto/sentinel/provider/v2/params.proto +17 -0
- package/proto/sentinel/provider/v2/provider.proto +24 -0
- package/proto/sentinel/provider/v3/genesis.proto +15 -0
- package/proto/sentinel/provider/v3/params.proto +13 -0
- package/proto/sentinel/session/v3/events.proto +30 -0
- package/proto/sentinel/session/v3/genesis.proto +15 -0
- package/proto/sentinel/session/v3/msg.proto +50 -0
- package/proto/sentinel/session/v3/params.proto +25 -0
- package/proto/sentinel/session/v3/proof.proto +25 -0
- package/proto/sentinel/session/v3/querier.proto +100 -0
- package/proto/sentinel/session/v3/session.proto +50 -0
- package/proto/sentinel/subscription/v2/allocation.proto +21 -0
- package/proto/sentinel/subscription/v2/payout.proto +22 -0
- package/proto/sentinel/subscription/v3/events.proto +65 -0
- package/proto/sentinel/subscription/v3/genesis.proto +17 -0
- package/proto/sentinel/subscription/v3/msg.proto +83 -0
- package/proto/sentinel/subscription/v3/params.proto +21 -0
- package/proto/sentinel/subscription/v3/subscription.proto +33 -0
- package/proto/sentinel/types/v1/bandwidth.proto +19 -0
- package/proto/sentinel/types/v1/price.proto +21 -0
- package/proto/sentinel/types/v1/renewal.proto +21 -0
- package/proto/sentinel/types/v1/status.proto +16 -0
- package/protocol/encoding.js +341 -0
- package/protocol/events.js +361 -0
- package/protocol/handshake.js +297 -0
- package/protocol/index.js +15 -0
- package/protocol/messages.js +346 -0
- package/protocol/plans.js +199 -0
- package/protocol/v2ray.js +268 -0
- package/protocol/v3.js +723 -0
- package/protocol/wireguard.js +125 -0
- package/security/index.js +132 -0
- package/session-manager.js +329 -0
- package/session-tracker.js +80 -0
- package/setup.js +376 -0
- package/speedtest/index.js +528 -0
- package/speedtest.js +567 -0
- package/src/client.ts +502 -0
- package/src/index.ts +20 -0
- package/state/index.js +347 -0
- package/state.js +516 -0
- package/test-all-chain-ops.js +493 -0
- package/test-all-logic.js +199 -0
- package/test-all-msg-types.js +292 -0
- package/test-every-connection.js +208 -0
- package/test-feegrant-connect.js +98 -0
- package/test-logic.js +148 -0
- package/test-mainnet.js +176 -0
- package/test-plan-lifecycle.js +335 -0
- package/tls-trust.js +132 -0
- package/tsconfig.build.json +20 -0
- package/tsconfig.json +34 -0
- package/types/chain.d.ts +746 -0
- package/types/connection.d.ts +425 -0
- package/types/errors.d.ts +174 -0
- package/types/index.d.ts +1380 -0
- package/types/nodes.d.ts +187 -0
- package/types/pricing.d.ts +156 -0
- package/types/protocol.d.ts +332 -0
- package/types/session.d.ts +236 -0
- package/types/settings.d.ts +192 -0
- package/v3protocol.js +1053 -0
- package/wallet/index.js +153 -0
- package/wireguard.js +307 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
# AI Agent Decision Tree — Every Possible Path
|
|
2
|
+
|
|
3
|
+
> For autonomous agents making decisions without human intervention.
|
|
4
|
+
> Every path leads to either a resolution or a structured request for help.
|
|
5
|
+
> Nothing goes unresolved — every dead end produces actionable output.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Decision Node 1: CAN I INSTALL?
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Agent needs VPN
|
|
13
|
+
│
|
|
14
|
+
├── Has Node.js 20+?
|
|
15
|
+
│ ├── YES → continue
|
|
16
|
+
│ └── NO → OUTPUT: { action: 'install-required', what: 'nodejs', url: 'https://nodejs.org', minVersion: '20.0.0' }
|
|
17
|
+
│
|
|
18
|
+
├── Can run npm install?
|
|
19
|
+
│ ├── YES → npm install sentinel-ai-connect
|
|
20
|
+
│ ├── NO (network restricted) → OUTPUT: { action: 'offline-install', instructions: 'download tarball from registry' }
|
|
21
|
+
│ └── NO (permissions) → OUTPUT: { action: 'permission-required', what: 'npm global install or local project' }
|
|
22
|
+
│
|
|
23
|
+
└── Postinstall (V2Ray download)?
|
|
24
|
+
├── SUCCESS → V2Ray 5.2.1 ready
|
|
25
|
+
├── FAIL (network) → OUTPUT: { action: 'manual-download', url: 'github.com/v2fly/v2ray-core/releases/tag/v5.2.1', sha256: '...' }
|
|
26
|
+
└── FAIL (disk) → OUTPUT: { action: 'disk-space-required', minMb: 50 }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Decision Node 2: WHAT CAN I USE?
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
setup() → environment check
|
|
33
|
+
│
|
|
34
|
+
├── V2Ray available?
|
|
35
|
+
│ ├── YES → can use ~630 V2Ray nodes (70% of network)
|
|
36
|
+
│ └── NO → must install (run: node setup.js)
|
|
37
|
+
│
|
|
38
|
+
├── WireGuard available?
|
|
39
|
+
│ ├── YES + Admin → can use ALL 1000+ nodes (100% of network)
|
|
40
|
+
│ ├── YES + No Admin → WG installed but locked. OUTPUT: { action: 'elevation-recommended', method: 'cscript run-admin.vbs', benefit: '+300 WireGuard nodes, faster, more reliable' }
|
|
41
|
+
│ └── NO → WG not installed. For auto-install: cscript run-admin.vbs setup.js
|
|
42
|
+
│
|
|
43
|
+
└── Neither available?
|
|
44
|
+
└── OUTPUT: { action: 'cannot-proceed', reason: 'no-tunnel-protocol', fix: 'run node setup.js' }
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Decision Node 3: DO I HAVE A WALLET?
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
Agent needs wallet
|
|
51
|
+
│
|
|
52
|
+
├── Has mnemonic already?
|
|
53
|
+
│ ├── YES → importWallet(mnemonic) → { address }
|
|
54
|
+
│ └── NO → createWallet() → { mnemonic, address }
|
|
55
|
+
│ └── CRITICAL: Store mnemonic securely. Never log it. Never commit it.
|
|
56
|
+
│
|
|
57
|
+
└── Is wallet funded?
|
|
58
|
+
├── getBalance(mnemonic) → { funded: true } → continue
|
|
59
|
+
└── getBalance(mnemonic) → { funded: false }
|
|
60
|
+
│
|
|
61
|
+
├── Agent has crypto on other chains?
|
|
62
|
+
│ ├── Has ATOM → swap on Osmosis DEX (ATOM → P2P)
|
|
63
|
+
│ ├── Has USDT/USDC → swap on Osmosis DEX (stable → ATOM → P2P)
|
|
64
|
+
│ ├── Has ETH → bridge to Cosmos via Gravity Bridge or Axelar, then swap
|
|
65
|
+
│ └── Has SOL/other → no direct bridge yet
|
|
66
|
+
│ └── OUTPUT: { action: 'funding-request', address: 'sent1...', amount: '100000 udvpn', reason: 'minimum for 1 VPN session', acceptedTokens: ['udvpn', 'ATOM via Osmosis'] }
|
|
67
|
+
│
|
|
68
|
+
├── Agent has fiat payment method?
|
|
69
|
+
│ └── OUTPUT: { action: 'fiat-not-supported-yet', workaround: 'buy ATOM on exchange → send to Cosmos wallet → swap to P2P on Osmosis', futureSupport: 'planned' }
|
|
70
|
+
│
|
|
71
|
+
├── Agent is operated by a company/human?
|
|
72
|
+
│ └── OUTPUT: { action: 'request-funding', to: 'operator', address: 'sent1...', minAmount: '1000000 udvpn (1 P2P)', estimatedUsage: '~10 GB or ~10 sessions' }
|
|
73
|
+
│
|
|
74
|
+
└── Agent has no payment capability?
|
|
75
|
+
└── OUTPUT: {
|
|
76
|
+
action: 'funding-needed',
|
|
77
|
+
address: 'sent1...',
|
|
78
|
+
minAmount: { udvpn: 1000000, p2p: '1.0 P2P', note: 'Covers gas + 1 GB on cheapest node' },
|
|
79
|
+
methods: [
|
|
80
|
+
{ method: 'direct-transfer', description: 'Send P2P tokens to this address' },
|
|
81
|
+
{ method: 'osmosis-swap', description: 'Swap ATOM/USDT → P2P on app.osmosis.zone' },
|
|
82
|
+
{ method: 'operator-grant', description: 'Fee grant from plan operator covers gas' },
|
|
83
|
+
],
|
|
84
|
+
request: {
|
|
85
|
+
type: 'funding-request',
|
|
86
|
+
reason: 'Autonomous agent needs VPN access for [task description]',
|
|
87
|
+
willingness: 'Will pay up to X per GB if funded',
|
|
88
|
+
contact: null,
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Decision Node 4: WHICH NODE DO I CONNECT TO?
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
recommend(preferences) → structured recommendation
|
|
97
|
+
│
|
|
98
|
+
├── Agent needs specific country?
|
|
99
|
+
│ ├── Nodes available in that country?
|
|
100
|
+
│ │ ├── YES → action: 'connect', primary: { node in country }
|
|
101
|
+
│ │ └── NO → check strictCountry flag
|
|
102
|
+
│ │ ├── strict=true → action: 'cannot-connect', reason: 'country-unavailable'
|
|
103
|
+
│ │ │ └── OUTPUT: {
|
|
104
|
+
│ │ │ action: 'country-unavailable',
|
|
105
|
+
│ │ │ requestedCountry: 'Germany',
|
|
106
|
+
│ │ │ nearestAvailable: ['Netherlands', 'Austria', 'Switzerland'],
|
|
107
|
+
│ │ │ suggestion: 'Try nearest country or wait for German node to come online',
|
|
108
|
+
│ │ │ bounty: {
|
|
109
|
+
│ │ │ description: 'Agent willing to pay premium for Germany access',
|
|
110
|
+
│ │ │ maxPricePerGb: 500000, // udvpn
|
|
111
|
+
│ │ │ duration: '1h',
|
|
112
|
+
│ │ │ }
|
|
113
|
+
│ │ │ }
|
|
114
|
+
│ │ └── strict=false → auto-fallback to nearest country
|
|
115
|
+
│ │ └── action: 'connect-fallback', primary: { node in nearby country }
|
|
116
|
+
│ │
|
|
117
|
+
│ └── Agent needs specific city?
|
|
118
|
+
│ ├── City data available (from node probe)?
|
|
119
|
+
│ │ ├── YES → filter by city
|
|
120
|
+
│ │ └── NO → fall back to country-level
|
|
121
|
+
│ └── No nodes in that city?
|
|
122
|
+
│ └── OUTPUT: { action: 'city-unavailable', fallbackToCountry: true }
|
|
123
|
+
│
|
|
124
|
+
├── Agent prioritizes cost?
|
|
125
|
+
│ ├── Sort by price ascending
|
|
126
|
+
│ ├── estimateCost({ budget }) → how many GB affordable
|
|
127
|
+
│ └── Warn if budget < 1 session
|
|
128
|
+
│
|
|
129
|
+
├── Agent prioritizes reliability?
|
|
130
|
+
│ ├── Sort by quality score (WireGuard bonus, low peer count, no clock drift)
|
|
131
|
+
│ └── Prefer nodes with 100% transport success (tcp, websocket)
|
|
132
|
+
│
|
|
133
|
+
├── Agent prioritizes speed?
|
|
134
|
+
│ ├── Prefer WireGuard (10-50+ Mbps typical)
|
|
135
|
+
│ ├── For V2Ray prefer tcp transport (highest throughput)
|
|
136
|
+
│ └── Prefer nodes with low peer count (<5)
|
|
137
|
+
│
|
|
138
|
+
└── Agent has no preference?
|
|
139
|
+
└── Default: reliability priority, auto protocol, any country
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Decision Node 5: CONNECTION FAILED — WHAT NOW?
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
connect() failed
|
|
146
|
+
│
|
|
147
|
+
├── Error: INSUFFICIENT_BALANCE
|
|
148
|
+
│ └── Go to Decision Node 3 (funding)
|
|
149
|
+
│
|
|
150
|
+
├── Error: NODE_OFFLINE / NODE_INACTIVE
|
|
151
|
+
│ ├── SDK auto-retries next node (maxAttempts=3)
|
|
152
|
+
│ ├── All retries failed?
|
|
153
|
+
│ │ ├── Try different country
|
|
154
|
+
│ │ ├── Try different protocol
|
|
155
|
+
│ │ └── Wait 60s and retry (node may come back)
|
|
156
|
+
│ └── OUTPUT: { action: 'retry-later', waitSeconds: 60, alternativeCountries: [...] }
|
|
157
|
+
│
|
|
158
|
+
├── Error: V2RAY_NOT_FOUND
|
|
159
|
+
│ └── OUTPUT: { action: 'install-required', what: 'v2ray', fix: 'node setup.js' }
|
|
160
|
+
│
|
|
161
|
+
├── Error: WG_NOT_AVAILABLE
|
|
162
|
+
│ ├── If V2Ray available → retry with protocol: 'v2ray'
|
|
163
|
+
│ └── If neither → OUTPUT: { action: 'install-required', what: 'wireguard or v2ray' }
|
|
164
|
+
│
|
|
165
|
+
├── Error: ALL_NODES_FAILED
|
|
166
|
+
│ ├── Network issue? Check internet connectivity first
|
|
167
|
+
│ ├── All LCD endpoints down? Chain may be under maintenance
|
|
168
|
+
│ └── OUTPUT: { action: 'network-issue', diagnosis: 'check internet → check lcd.sentinel.co → retry in 5min' }
|
|
169
|
+
│
|
|
170
|
+
├── Error: BROADCAST_FAILED / TX_FAILED
|
|
171
|
+
│ ├── Gas too low? SDK handles retry
|
|
172
|
+
│ ├── Sequence mismatch? SDK retries 5 times
|
|
173
|
+
│ └── If persists → OUTPUT: { action: 'chain-issue', waitMinutes: 5 }
|
|
174
|
+
│
|
|
175
|
+
├── Error: V2RAY_ALL_FAILED
|
|
176
|
+
│ ├── All transports on this node failed
|
|
177
|
+
│ ├── SDK already tried next node
|
|
178
|
+
│ └── Try: different country, or wait for node maintenance
|
|
179
|
+
│
|
|
180
|
+
├── Error: TLS_CERT_CHANGED
|
|
181
|
+
│ └── OUTPUT: { action: 'security-alert', severity: 'high', description: 'Node TLS certificate changed — possible MITM attack', recommendation: 'skip this node, report to network' }
|
|
182
|
+
│
|
|
183
|
+
└── Unknown error
|
|
184
|
+
└── OUTPUT: { action: 'unknown-error', error: err.message, code: err.code, suggestion: 'retry once, then try different node/country' }
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Decision Node 6: CONNECTED — NOW WHAT?
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
VPN connected
|
|
191
|
+
│
|
|
192
|
+
├── verify() → { verified: true }
|
|
193
|
+
│ └── Traffic is flowing through encrypted tunnel
|
|
194
|
+
│
|
|
195
|
+
├── verify() → { verified: false }
|
|
196
|
+
│ ├── Tunnel up but no traffic
|
|
197
|
+
│ ├── DNS issue? (especially with WireGuard full tunnel)
|
|
198
|
+
│ ├── Node may be overloaded
|
|
199
|
+
│ └── Recommendation: disconnect → try different node
|
|
200
|
+
│
|
|
201
|
+
├── Agent needs to monitor connection?
|
|
202
|
+
│ ├── onEvent('disconnected') → auto-reconnect or abort
|
|
203
|
+
│ ├── onEvent('error') → log and decide
|
|
204
|
+
│ └── Periodic verify() every 60s for long sessions
|
|
205
|
+
│
|
|
206
|
+
├── Connection drops mid-session?
|
|
207
|
+
│ ├── SDK has auto-reconnect if configured
|
|
208
|
+
│ ├── Session still active on chain → can reconnect without new payment
|
|
209
|
+
│ ├── Session expired → need new payment
|
|
210
|
+
│ └── Recommendation: call connect() again — SDK reuses session if valid
|
|
211
|
+
│
|
|
212
|
+
└── Agent done with VPN?
|
|
213
|
+
└── disconnect() → clean shutdown → session ended on chain
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Decision Node 7: PAYMENT & BUDGET MANAGEMENT
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
Agent managing budget
|
|
220
|
+
│
|
|
221
|
+
├── How much per GB?
|
|
222
|
+
│ ├── estimateCost({ gigabytes: 1 }) → typical 0.10-0.15 P2P
|
|
223
|
+
│ ├── estimateCost({ nodeAddress }) → exact price for specific node
|
|
224
|
+
│ └── Cheapest nodes: ~0.05 P2P/GB. Expensive: ~0.50 P2P/GB
|
|
225
|
+
│
|
|
226
|
+
├── How much can I get with my balance?
|
|
227
|
+
│ ├── estimateCost({ budget: myBalance }) → { forBudget: { gigabytes: X } }
|
|
228
|
+
│ └── Include gas costs: ~0.04 P2P per session
|
|
229
|
+
│
|
|
230
|
+
├── GB-based vs hourly?
|
|
231
|
+
│ ├── GB-based: pay for data used. Best for: browsing, scraping, API calls
|
|
232
|
+
│ ├── Hourly: pay for time. Best for: streaming, long connections, idle presence
|
|
233
|
+
│ └── Recommendation: GB-based for AI agents (predictable cost per task)
|
|
234
|
+
│
|
|
235
|
+
├── Agent wants to set spending limits?
|
|
236
|
+
│ ├── Track: sessions created, tokens spent, GB used
|
|
237
|
+
│ ├── Before each connect: check remaining budget
|
|
238
|
+
│ ├── Set maxPrice in recommend() to filter expensive nodes
|
|
239
|
+
│ └── Pattern:
|
|
240
|
+
│ if (estimateCost().grandTotal.udvpn > budget * 0.1) {
|
|
241
|
+
│ // Single session would cost >10% of budget — warn
|
|
242
|
+
│ }
|
|
243
|
+
│
|
|
244
|
+
├── Agent has tokens on wrong chain?
|
|
245
|
+
│ ├── ATOM on Cosmos Hub → swap on Osmosis to P2P
|
|
246
|
+
│ ├── USDT on Ethereum → bridge via Gravity/Axelar to Cosmos → swap
|
|
247
|
+
│ ├── Other tokens → OUTPUT: { action: 'token-swap-needed', from: 'ETH', to: 'P2P', via: 'Osmosis DEX' }
|
|
248
|
+
│ └── Future: SDK will include Osmosis swap helper
|
|
249
|
+
│
|
|
250
|
+
└── Agent ran out of tokens mid-session?
|
|
251
|
+
├── Session still active until allocation runs out
|
|
252
|
+
├── When allocation depleted: node stops routing traffic
|
|
253
|
+
├── Agent should monitor allocation: querySessionAllocation()
|
|
254
|
+
└── OUTPUT: { action: 'low-balance-warning', remainingGb: X, estimatedMinutesLeft: Y }
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Decision Node 8: AGENT-TO-AGENT & AGENT-TO-NETWORK COMMUNICATION
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
Agent can't solve problem alone
|
|
261
|
+
│
|
|
262
|
+
├── Country not available → place a demand signal
|
|
263
|
+
│ └── OUTPUT: {
|
|
264
|
+
│ type: 'demand-signal',
|
|
265
|
+
│ what: 'vpn-node',
|
|
266
|
+
│ where: 'Germany',
|
|
267
|
+
│ willingToPay: { perGb: 500000, perHour: 200000 },
|
|
268
|
+
│ duration: 'ongoing',
|
|
269
|
+
│ contact: { type: 'sentinel-address', value: 'sent1...' },
|
|
270
|
+
│ // Future: publish to on-chain demand marketplace
|
|
271
|
+
│ }
|
|
272
|
+
│
|
|
273
|
+
├── Agent needs funding → request from operator or marketplace
|
|
274
|
+
│ └── OUTPUT: {
|
|
275
|
+
│ type: 'funding-request',
|
|
276
|
+
│ address: 'sent1...',
|
|
277
|
+
│ amount: { min: 100000, preferred: 1000000, max: 10000000 },
|
|
278
|
+
│ reason: 'Web scraping task requires VPN in 3 countries',
|
|
279
|
+
│ taskDescription: '...',
|
|
280
|
+
│ estimatedUsage: { gb: 5, sessions: 3, duration: '2h' },
|
|
281
|
+
│ repayment: 'task revenue will cover costs',
|
|
282
|
+
│ }
|
|
283
|
+
│
|
|
284
|
+
├── Agent found a bug → report upstream
|
|
285
|
+
│ └── OUTPUT: {
|
|
286
|
+
│ type: 'bug-report',
|
|
287
|
+
│ nodeAddress: 'sentnode1...',
|
|
288
|
+
│ error: { code: 'V2RAY_ALL_FAILED', message: '...' },
|
|
289
|
+
│ context: { os: 'windows', protocol: 'v2ray', transport: 'grpc' },
|
|
290
|
+
│ // Write to: Sentinel SDK/suggestions/{timestamp}-agent-report.md
|
|
291
|
+
│ }
|
|
292
|
+
│
|
|
293
|
+
├── Agent wants to share results → contribute to network intelligence
|
|
294
|
+
│ └── OUTPUT: {
|
|
295
|
+
│ type: 'node-report',
|
|
296
|
+
│ nodeAddress: 'sentnode1...',
|
|
297
|
+
│ speed: 15.2, // Mbps
|
|
298
|
+
│ latency: 45, // ms
|
|
299
|
+
│ reliability: 'pass',
|
|
300
|
+
│ timestamp: '2026-03-26T19:00:00Z',
|
|
301
|
+
│ // Future: publish to decentralized node quality index
|
|
302
|
+
│ }
|
|
303
|
+
│
|
|
304
|
+
└── Agent needs help from another agent
|
|
305
|
+
└── OUTPUT: {
|
|
306
|
+
type: 'agent-request',
|
|
307
|
+
need: 'fund my wallet',
|
|
308
|
+
offer: 'will share VPN session results',
|
|
309
|
+
myAddress: 'sent1...',
|
|
310
|
+
// Future: agent-to-agent marketplace on Sentinel chain
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## Decision Node 9: PAYMENT METHOD NOT SUPPORTED
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
Agent has funds but wrong type
|
|
318
|
+
│
|
|
319
|
+
├── Has USDT (ERC-20 Ethereum)
|
|
320
|
+
│ ├── Bridge: Gravity Bridge or Axelar to Cosmos
|
|
321
|
+
│ ├── Then: Osmosis DEX swap USDT → P2P
|
|
322
|
+
│ └── OUTPUT: { action: 'cross-chain-swap', steps: ['bridge to cosmos', 'swap on osmosis'], estimatedTime: '15-30min', estimatedFees: '~$2-5 bridge + swap' }
|
|
323
|
+
│
|
|
324
|
+
├── Has USDC (multiple chains)
|
|
325
|
+
│ ├── If on Cosmos/Noble → direct swap on Osmosis
|
|
326
|
+
│ ├── If on Ethereum → bridge first
|
|
327
|
+
│ └── OUTPUT: { steps: [...], cheapestPath: 'Noble USDC → Osmosis → P2P' }
|
|
328
|
+
│
|
|
329
|
+
├── Has SOL
|
|
330
|
+
│ ├── No direct bridge to Cosmos yet
|
|
331
|
+
│ └── OUTPUT: { action: 'unsupported-currently', workaround: 'swap SOL→USDT on DEX, bridge to Cosmos, swap to P2P' }
|
|
332
|
+
│
|
|
333
|
+
├── Has BTC
|
|
334
|
+
│ ├── Nomic bridge (BTC → nBTC on Cosmos) → Osmosis → P2P
|
|
335
|
+
│ └── OUTPUT: { action: 'cross-chain-swap', via: 'Nomic Bridge', steps: [...] }
|
|
336
|
+
│
|
|
337
|
+
├── Has credit card / fiat only
|
|
338
|
+
│ ├── Buy ATOM on Coinbase/Binance/Kraken → withdraw to Cosmos wallet → Osmosis → P2P
|
|
339
|
+
│ └── OUTPUT: { action: 'fiat-onramp', steps: ['buy ATOM on exchange', 'withdraw to sent1... address', 'swap on Osmosis'], estimatedTime: '1-24h depending on exchange' }
|
|
340
|
+
│
|
|
341
|
+
└── Has nothing — pure autonomous agent with no funds
|
|
342
|
+
└── OUTPUT: {
|
|
343
|
+
action: 'request-sponsorship',
|
|
344
|
+
description: 'Autonomous agent needs VPN access but has no tokens',
|
|
345
|
+
request: {
|
|
346
|
+
type: 'fee-grant',
|
|
347
|
+
description: 'Operator covers gas, agent pays bandwidth from fee grant',
|
|
348
|
+
requiresPlan: true,
|
|
349
|
+
planOperatorBenefit: 'Agent drives usage and network growth',
|
|
350
|
+
},
|
|
351
|
+
alternatives: [
|
|
352
|
+
'Apply for fee grant from plan operator',
|
|
353
|
+
'Request funding from agent marketplace (future)',
|
|
354
|
+
'Earn tokens by providing node quality reports (future)',
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
## Quick Reference: Error → Action
|
|
360
|
+
|
|
361
|
+
| Error Code | Agent Action |
|
|
362
|
+
|-----------|-------------|
|
|
363
|
+
| `INSUFFICIENT_BALANCE` | Fund wallet → Decision Node 3 |
|
|
364
|
+
| `NODE_OFFLINE` | SDK auto-retries. If all fail → try different country |
|
|
365
|
+
| `NODE_INACTIVE` | SDK retries after 15s. If fails → different node |
|
|
366
|
+
| `V2RAY_NOT_FOUND` | Run `node setup.js` |
|
|
367
|
+
| `WG_NOT_AVAILABLE` | Retry with `protocol: 'v2ray'` |
|
|
368
|
+
| `V2RAY_ALL_FAILED` | Try different node. All nodes fail → wait 5min |
|
|
369
|
+
| `ALL_NODES_FAILED` | Check internet. Try different country. Wait 5min. |
|
|
370
|
+
| `ALL_ENDPOINTS_FAILED` | Chain unreachable. Wait 5min. Check lcd.sentinel.co |
|
|
371
|
+
| `BROADCAST_FAILED` | SDK retries 5x. If persists → chain congestion, wait |
|
|
372
|
+
| `TX_FAILED` | Check balance. Check gas. Try again. |
|
|
373
|
+
| `TLS_CERT_CHANGED` | Security alert. Skip node. |
|
|
374
|
+
| `SESSION_EXISTS` | SDK recovers automatically |
|
|
375
|
+
| `SESSION_POISONED` | SDK skips this session automatically |
|
|
376
|
+
| `CHAIN_LAG` | SDK waits 10s and retries automatically |
|
|
377
|
+
| `ALREADY_CONNECTED` | Call disconnect() first |
|
|
378
|
+
| `ABORTED` | Agent cancelled — intentional |
|