blue-js-sdk 2.4.0 → 2.6.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/README.md +3 -3
- package/chain/fee-grants.js +196 -0
- package/chain/index.js +8 -2
- package/chain/queries.js +105 -3
- package/chain/rpc.js +58 -2
- package/client.js +17 -1
- package/connection/connect.js +17 -5
- package/connection/disconnect.js +86 -10
- package/connection/index.js +2 -0
- package/cosmjs-setup.js +26 -2
- package/index.js +5 -1
- package/node-connect.js +101 -13
- package/operator.js +2 -0
- package/package.json +2 -5
- package/types/index.d.ts +2 -2
- package/ai-path/ADMIN-ELEVATION.md +0 -116
- package/ai-path/AI-MANIFESTO.md +0 -185
- package/ai-path/BREAKING.md +0 -74
- package/ai-path/CHECKLIST.md +0 -619
- package/ai-path/CONNECTION-STEPS.md +0 -724
- package/ai-path/DECISION-TREE.md +0 -422
- package/ai-path/DEPENDENCIES.md +0 -459
- package/ai-path/E2E-FLOW.md +0 -1707
- package/ai-path/FAILURES.md +0 -410
- package/ai-path/GUIDE.md +0 -1315
- package/ai-path/README.md +0 -599
- package/ai-path/SPLIT-TUNNEL.md +0 -266
- package/ai-path/cli.js +0 -548
- package/ai-path/connect.js +0 -1028
- package/ai-path/discover.js +0 -178
- package/ai-path/environment.js +0 -266
- package/ai-path/errors.js +0 -86
- package/ai-path/examples/autonomous-agent.mjs +0 -220
- package/ai-path/examples/multi-region.mjs +0 -174
- package/ai-path/examples/one-shot.mjs +0 -31
- package/ai-path/index.js +0 -79
- package/ai-path/pricing.js +0 -137
- package/ai-path/recommend.js +0 -413
- package/ai-path/run-admin.vbs +0 -25
- package/ai-path/setup.js +0 -291
- package/ai-path/wallet.js +0 -137
package/ai-path/DECISION-TREE.md
DELETED
|
@@ -1,422 +0,0 @@
|
|
|
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 operator-provisioned access (x402 / fee grant)?
|
|
62
|
-
│ │ ├── Has subscriptionId + feeGranter → OPERATOR-PROVISIONED MODE
|
|
63
|
-
│ │ │ └── connect({ mnemonic, subscriptionId, feeGranter, nodeAddress })
|
|
64
|
-
│ │ │ ├── Fee grant valid → connect with 0 P2P (operator pays gas)
|
|
65
|
-
│ │ │ ├── FEE_GRANT_NOT_FOUND → request provisioning from operator
|
|
66
|
-
│ │ │ ├── FEE_GRANT_EXPIRED → request grant renewal from operator
|
|
67
|
-
│ │ │ ├── FEE_GRANT_EXHAUSTED → request operator to top up grant
|
|
68
|
-
│ │ │ └── Disconnect also uses fee grant (MsgCancelSessionRequest)
|
|
69
|
-
│ │ ├── Has planId + feeGranter → PLAN MODE with fee grant
|
|
70
|
-
│ │ │ └── connect({ mnemonic, planId, feeGranter })
|
|
71
|
-
│ │ │ └── Subscribes to plan + starts session, operator pays gas
|
|
72
|
-
│ │ └── Has USDC on Base/Solana → x402 PAYMENT MODE
|
|
73
|
-
│ │ └── 1. Register sent1... address with x402 server
|
|
74
|
-
│ │ 2. Pay USDC via EIP-3009 (Base) or SPL transfer (Solana)
|
|
75
|
-
│ │ 3. Server provisions: subscription share + fee grant
|
|
76
|
-
│ │ 4. connect({ mnemonic, subscriptionId, feeGranter, nodeAddress })
|
|
77
|
-
│ │ 5. Agent connects with 0 P2P
|
|
78
|
-
│ │
|
|
79
|
-
│ ├── Agent has crypto on other chains?
|
|
80
|
-
│ │ ├── Has ATOM → swap on Osmosis DEX (ATOM → P2P)
|
|
81
|
-
│ │ ├── Has USDT/USDC → swap on Osmosis DEX (stable → ATOM → P2P)
|
|
82
|
-
│ │ ├── Has ETH → bridge to Cosmos via Gravity Bridge or Axelar, then swap
|
|
83
|
-
│ │ └── Has SOL/other → no direct bridge yet
|
|
84
|
-
│ │ └── OUTPUT: { action: 'funding-request', address: 'sent1...', amount: '100000 udvpn', reason: 'minimum for 1 VPN session', acceptedTokens: ['udvpn', 'ATOM via Osmosis'] }
|
|
85
|
-
│ │
|
|
86
|
-
│ ├── Agent has fiat payment method?
|
|
87
|
-
│ │ └── OUTPUT: { action: 'fiat-not-supported-yet', workaround: 'buy ATOM on exchange → send to Cosmos wallet → swap to P2P on Osmosis', futureSupport: 'planned' }
|
|
88
|
-
│ │
|
|
89
|
-
│ ├── Agent is operated by a company/human?
|
|
90
|
-
│ │ └── OUTPUT: { action: 'request-funding', to: 'operator', address: 'sent1...', minAmount: '1000000 udvpn (1 P2P)', estimatedUsage: '~10 GB or ~10 sessions' }
|
|
91
|
-
│ │
|
|
92
|
-
│ └── Agent has no payment capability?
|
|
93
|
-
│ └── OUTPUT: {
|
|
94
|
-
│ action: 'funding-needed',
|
|
95
|
-
│ address: 'sent1...',
|
|
96
|
-
│ minAmount: { udvpn: 1000000, p2p: '1.0 P2P', note: 'Covers gas + 1 GB on cheapest node' },
|
|
97
|
-
│ methods: [
|
|
98
|
-
│ { method: 'direct-transfer', description: 'Send P2P tokens to this address' },
|
|
99
|
-
│ { method: 'osmosis-swap', description: 'Swap ATOM/USDT → P2P on app.osmosis.zone' },
|
|
100
|
-
│ { method: 'operator-grant', description: 'Fee grant from plan operator covers gas' },
|
|
101
|
-
│ { method: 'x402-payment', description: 'Pay USDC on Base/Solana via x402 protocol — operator provisions access' },
|
|
102
|
-
│ ],
|
|
103
|
-
│ request: {
|
|
104
|
-
│ type: 'funding-request',
|
|
105
|
-
│ reason: 'Autonomous agent needs VPN access for [task description]',
|
|
106
|
-
│ willingness: 'Will pay up to X per GB if funded',
|
|
107
|
-
│ contact: null,
|
|
108
|
-
│ }
|
|
109
|
-
│ }
|
|
110
|
-
│
|
|
111
|
-
└── getBalance(mnemonic) → { funded: true } → continue
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## Decision Node 4: WHICH NODE DO I CONNECT TO?
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
recommend(preferences) → structured recommendation
|
|
118
|
-
│
|
|
119
|
-
├── Agent needs specific country?
|
|
120
|
-
│ ├── Nodes available in that country?
|
|
121
|
-
│ │ ├── YES → action: 'connect', primary: { node in country }
|
|
122
|
-
│ │ └── NO → check strictCountry flag
|
|
123
|
-
│ │ ├── strict=true → action: 'cannot-connect', reason: 'country-unavailable'
|
|
124
|
-
│ │ │ └── OUTPUT: {
|
|
125
|
-
│ │ │ action: 'country-unavailable',
|
|
126
|
-
│ │ │ requestedCountry: 'Germany',
|
|
127
|
-
│ │ │ nearestAvailable: ['Netherlands', 'Austria', 'Switzerland'],
|
|
128
|
-
│ │ │ suggestion: 'Try nearest country or wait for German node to come online',
|
|
129
|
-
│ │ │ bounty: {
|
|
130
|
-
│ │ │ description: 'Agent willing to pay premium for Germany access',
|
|
131
|
-
│ │ │ maxPricePerGb: 500000, // udvpn
|
|
132
|
-
│ │ │ duration: '1h',
|
|
133
|
-
│ │ │ }
|
|
134
|
-
│ │ │ }
|
|
135
|
-
│ │ └── strict=false → auto-fallback to nearest country
|
|
136
|
-
│ │ └── action: 'connect-fallback', primary: { node in nearby country }
|
|
137
|
-
│ │
|
|
138
|
-
│ └── Agent needs specific city?
|
|
139
|
-
│ ├── City data available (from node probe)?
|
|
140
|
-
│ │ ├── YES → filter by city
|
|
141
|
-
│ │ └── NO → fall back to country-level
|
|
142
|
-
│ └── No nodes in that city?
|
|
143
|
-
│ └── OUTPUT: { action: 'city-unavailable', fallbackToCountry: true }
|
|
144
|
-
│
|
|
145
|
-
├── Agent prioritizes cost?
|
|
146
|
-
│ ├── Sort by price ascending
|
|
147
|
-
│ ├── estimateCost({ budget }) → how many GB affordable
|
|
148
|
-
│ └── Warn if budget < 1 session
|
|
149
|
-
│
|
|
150
|
-
├── Agent prioritizes reliability?
|
|
151
|
-
│ ├── Sort by quality score (WireGuard bonus, low peer count, no clock drift)
|
|
152
|
-
│ └── Prefer nodes with 100% transport success (tcp, websocket)
|
|
153
|
-
│
|
|
154
|
-
├── Agent prioritizes speed?
|
|
155
|
-
│ ├── Prefer WireGuard (10-50+ Mbps typical)
|
|
156
|
-
│ ├── For V2Ray prefer tcp transport (highest throughput)
|
|
157
|
-
│ └── Prefer nodes with low peer count (<5)
|
|
158
|
-
│
|
|
159
|
-
└── Agent has no preference?
|
|
160
|
-
└── Default: reliability priority, auto protocol, any country
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Decision Node 5: CONNECTION FAILED — WHAT NOW?
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
connect() failed
|
|
167
|
-
│
|
|
168
|
-
├── Error: INSUFFICIENT_BALANCE
|
|
169
|
-
│ └── Go to Decision Node 3 (funding)
|
|
170
|
-
│
|
|
171
|
-
├── Error: NODE_OFFLINE / NODE_INACTIVE
|
|
172
|
-
│ ├── SDK auto-retries next node (maxAttempts=3)
|
|
173
|
-
│ ├── All retries failed?
|
|
174
|
-
│ │ ├── Try different country
|
|
175
|
-
│ │ ├── Try different protocol
|
|
176
|
-
│ │ └── Wait 60s and retry (node may come back)
|
|
177
|
-
│ └── OUTPUT: { action: 'retry-later', waitSeconds: 60, alternativeCountries: [...] }
|
|
178
|
-
│
|
|
179
|
-
├── Error: V2RAY_NOT_FOUND
|
|
180
|
-
│ └── OUTPUT: { action: 'install-required', what: 'v2ray', fix: 'node setup.js' }
|
|
181
|
-
│
|
|
182
|
-
├── Error: WG_NOT_AVAILABLE
|
|
183
|
-
│ ├── If V2Ray available → retry with protocol: 'v2ray'
|
|
184
|
-
│ └── If neither → OUTPUT: { action: 'install-required', what: 'wireguard or v2ray' }
|
|
185
|
-
│
|
|
186
|
-
├── Error: ALL_NODES_FAILED
|
|
187
|
-
│ ├── Network issue? Check internet connectivity first
|
|
188
|
-
│ ├── All LCD endpoints down? Chain may be under maintenance
|
|
189
|
-
│ └── OUTPUT: { action: 'network-issue', diagnosis: 'check internet → check lcd.sentinel.co → retry in 5min' }
|
|
190
|
-
│
|
|
191
|
-
├── Error: BROADCAST_FAILED / TX_FAILED
|
|
192
|
-
│ ├── Gas too low? SDK handles retry
|
|
193
|
-
│ ├── Sequence mismatch? SDK retries 5 times
|
|
194
|
-
│ └── If persists → OUTPUT: { action: 'chain-issue', waitMinutes: 5 }
|
|
195
|
-
│
|
|
196
|
-
├── Error: V2RAY_ALL_FAILED
|
|
197
|
-
│ ├── All transports on this node failed
|
|
198
|
-
│ ├── SDK already tried next node
|
|
199
|
-
│ └── Try: different country, or wait for node maintenance
|
|
200
|
-
│
|
|
201
|
-
├── Error: TLS_CERT_CHANGED
|
|
202
|
-
│ └── OUTPUT: { action: 'security-alert', severity: 'high', description: 'Node TLS certificate changed — possible MITM attack', recommendation: 'skip this node, report to network' }
|
|
203
|
-
│
|
|
204
|
-
└── Unknown error
|
|
205
|
-
└── OUTPUT: { action: 'unknown-error', error: err.message, code: err.code, suggestion: 'retry once, then try different node/country' }
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
## Decision Node 6: CONNECTED — NOW WHAT?
|
|
209
|
-
|
|
210
|
-
```
|
|
211
|
-
VPN connected
|
|
212
|
-
│
|
|
213
|
-
├── verify() → { verified: true }
|
|
214
|
-
│ └── Traffic is flowing through encrypted tunnel
|
|
215
|
-
│
|
|
216
|
-
├── verify() → { verified: false }
|
|
217
|
-
│ ├── Tunnel up but no traffic
|
|
218
|
-
│ ├── DNS issue? (especially with WireGuard full tunnel)
|
|
219
|
-
│ ├── Node may be overloaded
|
|
220
|
-
│ └── Recommendation: disconnect → try different node
|
|
221
|
-
│
|
|
222
|
-
├── Agent needs to monitor connection?
|
|
223
|
-
│ ├── onEvent('disconnected') → auto-reconnect or abort
|
|
224
|
-
│ ├── onEvent('error') → log and decide
|
|
225
|
-
│ └── Periodic verify() every 60s for long sessions
|
|
226
|
-
│
|
|
227
|
-
├── Connection drops mid-session?
|
|
228
|
-
│ ├── SDK has auto-reconnect if configured
|
|
229
|
-
│ ├── Session still active on chain → can reconnect without new payment
|
|
230
|
-
│ ├── Session expired → need new payment
|
|
231
|
-
│ └── Recommendation: call connect() again — SDK reuses session if valid
|
|
232
|
-
│
|
|
233
|
-
└── Agent done with VPN?
|
|
234
|
-
└── disconnect() → clean shutdown → session ended on chain
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
## Decision Node 7: PAYMENT & BUDGET MANAGEMENT
|
|
238
|
-
|
|
239
|
-
```
|
|
240
|
-
Agent managing budget
|
|
241
|
-
│
|
|
242
|
-
├── How much per GB?
|
|
243
|
-
│ ├── estimateCost({ gigabytes: 1 }) → typical 0.10-0.15 P2P
|
|
244
|
-
│ ├── estimateCost({ nodeAddress }) → exact price for specific node
|
|
245
|
-
│ └── Cheapest nodes: ~0.05 P2P/GB. Expensive: ~0.50 P2P/GB
|
|
246
|
-
│
|
|
247
|
-
├── How much can I get with my balance?
|
|
248
|
-
│ ├── estimateCost({ budget: myBalance }) → { forBudget: { gigabytes: X } }
|
|
249
|
-
│ └── Include gas costs: ~0.04 P2P per session
|
|
250
|
-
│
|
|
251
|
-
├── GB-based vs hourly?
|
|
252
|
-
│ ├── GB-based: pay for data used. Best for: browsing, scraping, API calls
|
|
253
|
-
│ ├── Hourly: pay for time. Best for: streaming, long connections, idle presence
|
|
254
|
-
│ └── Recommendation: GB-based for AI agents (predictable cost per task)
|
|
255
|
-
│
|
|
256
|
-
├── Agent wants to set spending limits?
|
|
257
|
-
│ ├── Track: sessions created, tokens spent, GB used
|
|
258
|
-
│ ├── Before each connect: check remaining budget
|
|
259
|
-
│ ├── Set maxPrice in recommend() to filter expensive nodes
|
|
260
|
-
│ └── Pattern:
|
|
261
|
-
│ if (estimateCost().grandTotal.udvpn > budget * 0.1) {
|
|
262
|
-
│ // Single session would cost >10% of budget — warn
|
|
263
|
-
│ }
|
|
264
|
-
│
|
|
265
|
-
├── Agent has tokens on wrong chain?
|
|
266
|
-
│ ├── ATOM on Cosmos Hub → swap on Osmosis to P2P
|
|
267
|
-
│ ├── USDT on Ethereum → bridge via Gravity/Axelar to Cosmos → swap
|
|
268
|
-
│ ├── Other tokens → OUTPUT: { action: 'token-swap-needed', from: 'ETH', to: 'P2P', via: 'Osmosis DEX' }
|
|
269
|
-
│ └── Future: SDK will include Osmosis swap helper
|
|
270
|
-
│
|
|
271
|
-
└── Agent ran out of tokens mid-session?
|
|
272
|
-
├── Session still active until allocation runs out
|
|
273
|
-
├── When allocation depleted: node stops routing traffic
|
|
274
|
-
├── Agent should monitor allocation: querySessionAllocation()
|
|
275
|
-
└── OUTPUT: { action: 'low-balance-warning', remainingGb: X, estimatedMinutesLeft: Y }
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
## Decision Node 8: AGENT-TO-AGENT & AGENT-TO-NETWORK COMMUNICATION
|
|
279
|
-
|
|
280
|
-
```
|
|
281
|
-
Agent can't solve problem alone
|
|
282
|
-
│
|
|
283
|
-
├── Country not available → place a demand signal
|
|
284
|
-
│ └── OUTPUT: {
|
|
285
|
-
│ type: 'demand-signal',
|
|
286
|
-
│ what: 'vpn-node',
|
|
287
|
-
│ where: 'Germany',
|
|
288
|
-
│ willingToPay: { perGb: 500000, perHour: 200000 },
|
|
289
|
-
│ duration: 'ongoing',
|
|
290
|
-
│ contact: { type: 'sentinel-address', value: 'sent1...' },
|
|
291
|
-
│ // Future: publish to on-chain demand marketplace
|
|
292
|
-
│ }
|
|
293
|
-
│
|
|
294
|
-
├── Agent needs funding → request from operator or marketplace
|
|
295
|
-
│ └── OUTPUT: {
|
|
296
|
-
│ type: 'funding-request',
|
|
297
|
-
│ address: 'sent1...',
|
|
298
|
-
│ amount: { min: 100000, preferred: 1000000, max: 10000000 },
|
|
299
|
-
│ reason: 'Web scraping task requires VPN in 3 countries',
|
|
300
|
-
│ taskDescription: '...',
|
|
301
|
-
│ estimatedUsage: { gb: 5, sessions: 3, duration: '2h' },
|
|
302
|
-
│ repayment: 'task revenue will cover costs',
|
|
303
|
-
│ }
|
|
304
|
-
│
|
|
305
|
-
├── Agent found a bug → report upstream
|
|
306
|
-
│ └── OUTPUT: {
|
|
307
|
-
│ type: 'bug-report',
|
|
308
|
-
│ nodeAddress: 'sentnode1...',
|
|
309
|
-
│ error: { code: 'V2RAY_ALL_FAILED', message: '...' },
|
|
310
|
-
│ context: { os: 'windows', protocol: 'v2ray', transport: 'grpc' },
|
|
311
|
-
│ // Write to: Sentinel SDK/suggestions/{timestamp}-agent-report.md
|
|
312
|
-
│ }
|
|
313
|
-
│
|
|
314
|
-
├── Agent wants to share results → contribute to network intelligence
|
|
315
|
-
│ └── OUTPUT: {
|
|
316
|
-
│ type: 'node-report',
|
|
317
|
-
│ nodeAddress: 'sentnode1...',
|
|
318
|
-
│ speed: 15.2, // Mbps
|
|
319
|
-
│ latency: 45, // ms
|
|
320
|
-
│ reliability: 'pass',
|
|
321
|
-
│ timestamp: '2026-03-26T19:00:00Z',
|
|
322
|
-
│ // Future: publish to decentralized node quality index
|
|
323
|
-
│ }
|
|
324
|
-
│
|
|
325
|
-
└── Agent needs help from another agent
|
|
326
|
-
└── OUTPUT: {
|
|
327
|
-
type: 'agent-request',
|
|
328
|
-
need: 'fund my wallet',
|
|
329
|
-
offer: 'will share VPN session results',
|
|
330
|
-
myAddress: 'sent1...',
|
|
331
|
-
// Future: agent-to-agent marketplace on Sentinel chain
|
|
332
|
-
}
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
## Decision Node 9: PAYMENT METHOD NOT SUPPORTED
|
|
336
|
-
|
|
337
|
-
```
|
|
338
|
-
Agent has funds but wrong type
|
|
339
|
-
│
|
|
340
|
-
├── Has USDC on Base (preferred — cheapest, x402 native)
|
|
341
|
-
│ ├── x402 protocol: pay USDC on Base → get VPN access instantly
|
|
342
|
-
│ ├── Price: $0.033/day, $0.233/week, $1.00/month
|
|
343
|
-
│ ├── Flow: register sent1... → pay via EIP-3009 → server provisions sub + fee grant
|
|
344
|
-
│ └── OUTPUT: {
|
|
345
|
-
│ action: 'x402-payment',
|
|
346
|
-
│ chain: 'base',
|
|
347
|
-
│ contract: '0x923F41eb162d4F7D274CE8cE8b8178883E7E2196',
|
|
348
|
-
│ steps: ['register sent1... with x402 server', 'approve USDC', 'pay via contract', 'connect with subscriptionId + feeGranter'],
|
|
349
|
-
│ estimatedTime: '<30s',
|
|
350
|
-
│ estimatedFees: '<$0.001 (Base L2 gas)',
|
|
351
|
-
│ pricing: { '1day': '$0.033', '7days': '$0.233', '30days': '$1.00' },
|
|
352
|
-
│ }
|
|
353
|
-
│
|
|
354
|
-
├── Has USDC on Solana
|
|
355
|
-
│ ├── x402 protocol: SPL transfer + memo to operator
|
|
356
|
-
│ └── OUTPUT: { action: 'x402-payment', chain: 'solana', steps: ['SPL transfer to operator ATA', 'memo: x402:sent1...:hours:N'], estimatedTime: '<5s' }
|
|
357
|
-
│
|
|
358
|
-
├── Has USDT (ERC-20 Ethereum)
|
|
359
|
-
│ ├── Bridge: Gravity Bridge or Axelar to Cosmos
|
|
360
|
-
│ ├── Then: Osmosis DEX swap USDT → P2P
|
|
361
|
-
│ └── OUTPUT: { action: 'cross-chain-swap', steps: ['bridge to cosmos', 'swap on osmosis'], estimatedTime: '15-30min', estimatedFees: '~$2-5 bridge + swap' }
|
|
362
|
-
│
|
|
363
|
-
├── Has USDC on other chains (Ethereum, Cosmos/Noble)
|
|
364
|
-
│ ├── If on Cosmos/Noble → direct swap on Osmosis
|
|
365
|
-
│ ├── If on Ethereum → bridge first (or swap to Base USDC and use x402)
|
|
366
|
-
│ └── OUTPUT: { steps: [...], cheapestPath: 'Bridge to Base → x402 payment' }
|
|
367
|
-
│
|
|
368
|
-
├── Has SOL (not USDC)
|
|
369
|
-
│ ├── Swap SOL → USDC on Jupiter/Raydium, then use x402 Solana payment
|
|
370
|
-
│ └── OUTPUT: { action: 'swap-then-x402', steps: ['swap SOL→USDC on Jupiter', 'x402 payment via Solana'], estimatedTime: '<30s' }
|
|
371
|
-
│
|
|
372
|
-
├── Has BTC
|
|
373
|
-
│ ├── Nomic bridge (BTC → nBTC on Cosmos) → Osmosis → P2P
|
|
374
|
-
│ └── OUTPUT: { action: 'cross-chain-swap', via: 'Nomic Bridge', steps: [...] }
|
|
375
|
-
│
|
|
376
|
-
├── Has credit card / fiat only
|
|
377
|
-
│ ├── Buy USDC on Coinbase → send to Base wallet → use x402 (fastest)
|
|
378
|
-
│ ├── Buy ATOM on exchange → withdraw to Cosmos → Osmosis → P2P (slower)
|
|
379
|
-
│ └── OUTPUT: { action: 'fiat-onramp', steps: ['buy USDC on Coinbase/Binance', 'withdraw to Base wallet', 'x402 payment'], estimatedTime: '1-24h depending on exchange' }
|
|
380
|
-
│
|
|
381
|
-
└── Has nothing — pure autonomous agent with no funds
|
|
382
|
-
└── OUTPUT: {
|
|
383
|
-
action: 'request-sponsorship',
|
|
384
|
-
description: 'Autonomous agent needs VPN access but has no tokens',
|
|
385
|
-
request: {
|
|
386
|
-
type: 'fee-grant',
|
|
387
|
-
description: 'Operator covers gas, agent pays bandwidth from fee grant',
|
|
388
|
-
requiresPlan: true,
|
|
389
|
-
planOperatorBenefit: 'Agent drives usage and network growth',
|
|
390
|
-
},
|
|
391
|
-
alternatives: [
|
|
392
|
-
'x402 payment: pay USDC on Base/Solana (cheapest — $0.033/day)',
|
|
393
|
-
'Apply for fee grant from plan operator',
|
|
394
|
-
'Request funding from agent marketplace (future)',
|
|
395
|
-
'Earn tokens by providing node quality reports (future)',
|
|
396
|
-
]
|
|
397
|
-
}
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
## Quick Reference: Error → Action
|
|
401
|
-
|
|
402
|
-
| Error Code | Agent Action |
|
|
403
|
-
|-----------|-------------|
|
|
404
|
-
| `INSUFFICIENT_BALANCE` | Fund wallet → Decision Node 3 (or use x402/fee grant) |
|
|
405
|
-
| `FEE_GRANT_NOT_FOUND` | No fee grant from operator → request provisioning |
|
|
406
|
-
| `FEE_GRANT_EXPIRED` | Fee grant expired → request renewal from operator |
|
|
407
|
-
| `FEE_GRANT_EXHAUSTED` | Fee grant spend limit too low → request operator to top up |
|
|
408
|
-
| `NODE_OFFLINE` | SDK auto-retries. If all fail → try different country |
|
|
409
|
-
| `NODE_INACTIVE` | SDK retries after 15s. If fails → different node |
|
|
410
|
-
| `V2RAY_NOT_FOUND` | Run `node setup.js` |
|
|
411
|
-
| `WG_NOT_AVAILABLE` | Retry with `protocol: 'v2ray'` |
|
|
412
|
-
| `V2RAY_ALL_FAILED` | Try different node. All nodes fail → wait 5min |
|
|
413
|
-
| `ALL_NODES_FAILED` | Check internet. Try different country. Wait 5min. |
|
|
414
|
-
| `ALL_ENDPOINTS_FAILED` | Chain unreachable. Wait 5min. Check lcd.sentinel.co |
|
|
415
|
-
| `BROADCAST_FAILED` | SDK retries 5x. If persists → chain congestion, wait |
|
|
416
|
-
| `TX_FAILED` | Check balance. Check gas. Try again. |
|
|
417
|
-
| `TLS_CERT_CHANGED` | Security alert. Skip node. |
|
|
418
|
-
| `SESSION_EXISTS` | SDK recovers automatically |
|
|
419
|
-
| `SESSION_POISONED` | SDK skips this session automatically |
|
|
420
|
-
| `CHAIN_LAG` | SDK waits 10s and retries automatically |
|
|
421
|
-
| `ALREADY_CONNECTED` | Call disconnect() first |
|
|
422
|
-
| `ABORTED` | Agent cancelled — intentional |
|