@prktsol/prkt 1.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/.env.devnet.all-protocols.example +18 -0
- package/.env.devnet.autonomous.example +16 -0
- package/.env.devnet.jupiter.example +16 -0
- package/.env.devnet.kamino.example +17 -0
- package/.env.devnet.marinade.example +16 -0
- package/.env.devnet.orca.example +16 -0
- package/.env.devnet.raydium.example +17 -0
- package/.env.example +32 -0
- package/ARCHITECTURE.md +159 -0
- package/CLI.md +509 -0
- package/CLI_QUICKSTART.md +108 -0
- package/COMPATIBILITY.md +103 -0
- package/DEVNET_PROTOCOL_ADDRESSES.md +72 -0
- package/README.md +339 -0
- package/dist/agent/AgentManager.js +166 -0
- package/dist/agent/AgentRuntime.js +92 -0
- package/dist/agent/DecisionEngine.js +95 -0
- package/dist/agent/MockPriceFeed.js +13 -0
- package/dist/agent/intents/types.js +2 -0
- package/dist/agent/new-index.js +17 -0
- package/dist/agent/policyFactory.js +54 -0
- package/dist/agent/registry/AgentRegistry.js +16 -0
- package/dist/agent/runner/AgentRunner.js +266 -0
- package/dist/agent/strategies/MemoHeartbeatStrategy.js +15 -0
- package/dist/agent/strategies/SimpleScriptedTransferStrategy.js +27 -0
- package/dist/agent/strategies/TokenRebalancerStrategy.js +35 -0
- package/dist/agent/strategies/TreasuryDistributorStrategy.js +29 -0
- package/dist/agent/strategies/UniversalDeFiStrategy.js +19 -0
- package/dist/agent/types/AgentContext.js +2 -0
- package/dist/cli/index.js +1159 -0
- package/dist/cli/services/activityStore.js +42 -0
- package/dist/cli/services/agentRegistry.js +123 -0
- package/dist/cli/services/agentRuntime.js +55 -0
- package/dist/cli/services/storagePaths.js +64 -0
- package/dist/cli/services/strategyFactory.js +66 -0
- package/dist/cli/services/walletCrypto.js +120 -0
- package/dist/cli/services/walletRegistry.js +145 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/utils/completion.js +62 -0
- package/dist/cli/utils/output.js +44 -0
- package/dist/config/agentPolicies.js +37 -0
- package/dist/config/env.js +249 -0
- package/dist/config/policyPresets.js +105 -0
- package/dist/core/balances/BalanceService.js +34 -0
- package/dist/core/funding/DevnetFundingService.js +105 -0
- package/dist/core/idempotency/ExecutionIdempotencyGuard.js +100 -0
- package/dist/core/index.js +19 -0
- package/dist/core/rpc/RpcClient.js +45 -0
- package/dist/core/rpc/RpcFailoverClient.js +97 -0
- package/dist/core/tokens/TokenService.js +75 -0
- package/dist/core/transactions/PostTransactionVerifier.js +103 -0
- package/dist/core/transactions/TransactionService.js +104 -0
- package/dist/core/types/services.js +2 -0
- package/dist/core/wallet/WalletManager.js +120 -0
- package/dist/defi/DeFiCoordinator.js +93 -0
- package/dist/defi/DeFiExecutor.js +29 -0
- package/dist/defi/DeFiPolicyGuard.js +31 -0
- package/dist/defi/adapters/JupiterAdapter.js +25 -0
- package/dist/defi/adapters/KaminoAdapter.js +50 -0
- package/dist/defi/adapters/MarinadeAdapter.js +25 -0
- package/dist/defi/adapters/RaydiumAdapter.js +45 -0
- package/dist/defi/kamino/kaminoInstructionCompat.js +24 -0
- package/dist/defi/kamino/kaminoLiveConfig.js +60 -0
- package/dist/defi/kamino/loadKaminoMarketWithFallback.js +68 -0
- package/dist/defi/lp/LpInstructionBuilder.js +2 -0
- package/dist/defi/lp/RaydiumLpInstructionBuilder.js +100 -0
- package/dist/defi/lp/raydiumDevnetConfig.js +62 -0
- package/dist/defi/protocols.js +29 -0
- package/dist/defi/types.js +2 -0
- package/dist/defi/universal/UniversalDeFiOrchestrator.js +126 -0
- package/dist/defi/universal/adapters.js +73 -0
- package/dist/defi/universal/index.js +5 -0
- package/dist/defi/universal/liveExecutors.js +394 -0
- package/dist/defi/universal/types.js +2 -0
- package/dist/demo/scenarios/multiAgentDevnetScenario.js +170 -0
- package/dist/demo/scripts/runMultiAgentDevnetDemo.js +17 -0
- package/dist/dex/JupiterSwapClient.js +59 -0
- package/dist/dex/SwapExecutor.js +52 -0
- package/dist/index.js +22 -0
- package/dist/kora/KoraRpcClient.js +60 -0
- package/dist/kora/KoraSigner.js +57 -0
- package/dist/kora/gaslessDemo.js +18 -0
- package/dist/policy/PolicyGuard.js +158 -0
- package/dist/policy/emergencyLock.js +164 -0
- package/dist/policy/engine/PolicyEngine.js +237 -0
- package/dist/policy/errors.js +10 -0
- package/dist/policy/index.js +7 -0
- package/dist/policy/sandbox/SandboxExecutor.js +77 -0
- package/dist/policy/types/policy.js +2 -0
- package/dist/scripts/devnetFunding.js +28 -0
- package/dist/scripts/devnetWalletPreflight.js +16 -0
- package/dist/scripts/localnetCheck.js +27 -0
- package/dist/scripts/managedAgentWallet.js +81 -0
- package/dist/scripts/mode.js +6 -0
- package/dist/scripts/releaseReadiness.js +93 -0
- package/dist/scripts/runAgentUniversalDeFi.js +115 -0
- package/dist/scripts/runAutonomousAgentWalletDevnet.js +154 -0
- package/dist/scripts/runAutonomousPortfolioDevnet.js +390 -0
- package/dist/scripts/runBorrowStrategy.js +35 -0
- package/dist/scripts/runDeFiSuite.js +41 -0
- package/dist/scripts/runDemoRehearsal.js +111 -0
- package/dist/scripts/runDevnetWalletDemo.js +53 -0
- package/dist/scripts/runGaslessMemo.js +23 -0
- package/dist/scripts/runGaslessWalletDemo.js +60 -0
- package/dist/scripts/runKaminoDevnet.js +109 -0
- package/dist/scripts/runLpStrategy.js +32 -0
- package/dist/scripts/runMarinadeDevnet.js +97 -0
- package/dist/scripts/runOrcaLpDevnet.js +208 -0
- package/dist/scripts/runRaydiumLpDevnet.js +95 -0
- package/dist/scripts/runReleaseReadiness.js +22 -0
- package/dist/scripts/runStakeStrategy.js +33 -0
- package/dist/scripts/runStressTest.js +41 -0
- package/dist/scripts/runTradeLoop.js +53 -0
- package/dist/scripts/runUniversalDeFiDemo.js +84 -0
- package/dist/scripts/runYieldStrategy.js +33 -0
- package/dist/scripts/runtimeFactory.js +27 -0
- package/dist/scripts/shared.js +24 -0
- package/dist/scripts/simulateAttack.js +40 -0
- package/dist/scripts/simulateSwarm.js +106 -0
- package/dist/simulation/attack.js +30 -0
- package/dist/solana/programs.js +9 -0
- package/dist/spl/TokenWallet.js +65 -0
- package/dist/types/policy.js +2 -0
- package/dist/wallet/WalletManager.js +5 -0
- package/package.json +99 -0
package/CLI.md
ADDED
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
# PRKT CLI Documentation
|
|
2
|
+
|
|
3
|
+
This document is the complete reference for the PRKT command-line interface.
|
|
4
|
+
|
|
5
|
+
For the full end-to-end product guide, see:
|
|
6
|
+
- [FULL_DOCUMENTATION.md](./FULL_DOCUMENTATION.md)
|
|
7
|
+
|
|
8
|
+
- Published binary entrypoint: `prkt ...`
|
|
9
|
+
- Source entrypoint: `npm run cli -- ...`
|
|
10
|
+
- CLI name in help output: `prkt`
|
|
11
|
+
- Global machine-readable output mode: `--json`
|
|
12
|
+
|
|
13
|
+
## 1) CLI Purpose
|
|
14
|
+
|
|
15
|
+
The CLI is an operations/control layer on top of the existing architecture.
|
|
16
|
+
|
|
17
|
+
It does not move core domain logic into command handlers.
|
|
18
|
+
|
|
19
|
+
- Wallet and token execution is delegated to Wallet Core services.
|
|
20
|
+
- Policy inspection is delegated to Policy layer modules.
|
|
21
|
+
- Agent execution is delegated to Agent Runner and DeFi orchestration.
|
|
22
|
+
- Monitoring/audit reads lightweight persistent activity state.
|
|
23
|
+
|
|
24
|
+
## 2) Quickstart
|
|
25
|
+
|
|
26
|
+
1. Install the CLI:
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g @prktsol/prkt
|
|
29
|
+
```
|
|
30
|
+
Alternative, from source:
|
|
31
|
+
```bash
|
|
32
|
+
npm install
|
|
33
|
+
```
|
|
34
|
+
2. Confirm CLI is reachable and initialize local state:
|
|
35
|
+
```bash
|
|
36
|
+
prkt --help
|
|
37
|
+
prkt init
|
|
38
|
+
```
|
|
39
|
+
3. Create a wallet:
|
|
40
|
+
```bash
|
|
41
|
+
prkt wallet create --name treasury
|
|
42
|
+
```
|
|
43
|
+
4. Check balance:
|
|
44
|
+
```bash
|
|
45
|
+
prkt wallet balance --name treasury
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 3) Global Options
|
|
49
|
+
|
|
50
|
+
- `--json`: output JSON payloads (tables/pretty formatting disabled)
|
|
51
|
+
|
|
52
|
+
Example:
|
|
53
|
+
```bash
|
|
54
|
+
prkt --json wallet list
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 3.1) init
|
|
58
|
+
Bootstrap local PRKT state for the current user install.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
prkt init
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Outputs:
|
|
65
|
+
|
|
66
|
+
- current custody model
|
|
67
|
+
- local CLI data directory
|
|
68
|
+
- whether that directory is writable
|
|
69
|
+
- wallet key source (`local-file` by default)
|
|
70
|
+
- recommended next steps
|
|
71
|
+
|
|
72
|
+
## 4) Wallet Commands
|
|
73
|
+
|
|
74
|
+
### wallet create
|
|
75
|
+
Create a managed wallet and register a matching agent profile.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm run cli -- wallet create --name <name>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### wallet list
|
|
82
|
+
List all managed wallets.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm run cli -- wallet list
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### wallet show
|
|
89
|
+
Show one managed wallet.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm run cli -- wallet show --name <name>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### wallet fund
|
|
96
|
+
Fund wallet from the configured devnet treasury if present, otherwise request a devnet airdrop.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm run cli -- wallet fund --name <name> --sol <amount>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### wallet balance
|
|
103
|
+
Get SOL balance.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npm run cli -- wallet balance --name <name>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### wallet balance-spl
|
|
110
|
+
Get SPL token balance for a mint.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm run cli -- wallet balance-spl --name <name> --mint <mint>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### wallet transfer-sol
|
|
117
|
+
Transfer SOL. `--from` accepts wallet name or agent name.
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm run cli -- wallet transfer-sol --from <agentOrWallet> --to <pubkey> --amount <amount>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### wallet transfer-spl
|
|
124
|
+
Transfer SPL token amount in UI units. `--from` accepts wallet or agent.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npm run cli -- wallet transfer-spl --from <agentOrWallet> --to <pubkey> --mint <mint> --amount <amount>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## 5) Token Commands
|
|
131
|
+
|
|
132
|
+
### token mint-demo
|
|
133
|
+
Create a new demo mint and mint amount to authority ATA.
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
npm run cli -- token mint-demo --authority <wallet> --decimals <n> --amount <amount>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### token create-ata
|
|
140
|
+
Create ATA for owner wallet and mint (if missing).
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npm run cli -- token create-ata --owner <wallet> --mint <mint>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## 6) Policy Commands
|
|
147
|
+
|
|
148
|
+
### policy show
|
|
149
|
+
Show the resolved provider policy configuration for an agent, including preset and overrides.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
npm run cli -- policy show --agent <agent>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### policy presets
|
|
156
|
+
List available provider policy presets.
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
npm run cli -- policy presets
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### policy set-preset
|
|
163
|
+
Assign a provider policy preset to an agent.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npm run cli -- policy set-preset --agent <agent> --preset <preset>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Supported presets:
|
|
170
|
+
- `observe-only`
|
|
171
|
+
- `simulate-only`
|
|
172
|
+
- `auto-devnet-safe`
|
|
173
|
+
- `guarded-live`
|
|
174
|
+
- `custom`
|
|
175
|
+
|
|
176
|
+
### policy set-limits
|
|
177
|
+
Set or replace persisted policy overrides for an agent.
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npm run cli -- policy set-limits --agent <agent> --max-sol-per-tx-lamports 500000000
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Useful options:
|
|
184
|
+
- `--approval-mode <sandbox|live>`
|
|
185
|
+
- `--max-sol-per-tx-lamports <n>`
|
|
186
|
+
- `--max-spl-per-tx-raw <n>`
|
|
187
|
+
- `--max-transactions-per-session <n>`
|
|
188
|
+
- `--max-transactions-per-day <n>`
|
|
189
|
+
- `--session-ttl-minutes <n>`
|
|
190
|
+
- `--allowed-mints <csv>`
|
|
191
|
+
- `--allowed-destinations <csv>`
|
|
192
|
+
- `--allowed-close-destinations <csv>`
|
|
193
|
+
- `--extra-program-ids <csv>`
|
|
194
|
+
- `--allow-opaque-program-ids <csv>`
|
|
195
|
+
- `--deny-unknown-instructions <true|false>`
|
|
196
|
+
- `--require-simulation-success <true|false>`
|
|
197
|
+
- `--reject-suspicious-balance-deltas <true|false>`
|
|
198
|
+
|
|
199
|
+
### policy clear-overrides
|
|
200
|
+
Clear persisted policy overrides for an agent while keeping the assigned preset.
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
npm run cli -- policy clear-overrides --agent <agent>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### policy validate-intent
|
|
207
|
+
Build and inspect supported intent types using `PolicyEngine`.
|
|
208
|
+
|
|
209
|
+
Supported intent file `type` values:
|
|
210
|
+
- `write-memo`
|
|
211
|
+
- `transfer-sol`
|
|
212
|
+
- `transfer-spl`
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
npm run cli -- policy validate-intent --agent <agent> --intent-file <file>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Example intent file:
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"type": "transfer-sol",
|
|
222
|
+
"to": "<recipient-pubkey>",
|
|
223
|
+
"lamports": 1000000
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## 7) Agent Commands
|
|
228
|
+
|
|
229
|
+
### agent list
|
|
230
|
+
List managed agents and state.
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
npm run cli -- agent list
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### agent show
|
|
237
|
+
Show one agent profile.
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
npm run cli -- agent show --agent <name>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### agent run
|
|
244
|
+
Run one agent once with selected strategy.
|
|
245
|
+
|
|
246
|
+
Supported strategy names:
|
|
247
|
+
- `memo-heartbeat`
|
|
248
|
+
- `simple-scripted-transfer`
|
|
249
|
+
- `universal-defi`
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
npm run cli -- agent run --agent <name> --strategy <strategy>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### agent run-all
|
|
256
|
+
Run all active agents once.
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
npm run cli -- agent run-all
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### agent stop
|
|
263
|
+
Mark an agent as stopped.
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
npm run cli -- agent stop --agent <name>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### agent logs
|
|
270
|
+
Show recent activity rows for one agent.
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
npm run cli -- agent logs --agent <name>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## 8) Monitoring Commands
|
|
277
|
+
|
|
278
|
+
### monitor overview
|
|
279
|
+
Concise operational summary per agent:
|
|
280
|
+
- agent id
|
|
281
|
+
- wallet
|
|
282
|
+
- SOL
|
|
283
|
+
- tracked SPL summary
|
|
284
|
+
- last action
|
|
285
|
+
- last signature
|
|
286
|
+
- policy mode
|
|
287
|
+
- status
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
npm run cli -- monitor overview
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### monitor balances
|
|
294
|
+
Wallet SOL balances.
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
npm run cli -- monitor balances
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### monitor txs
|
|
301
|
+
Recent transaction activity (from CLI activity store).
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
npm run cli -- monitor txs
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### monitor agents
|
|
308
|
+
Agent runtime state rows.
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
npm run cli -- monitor agents
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### monitor watch
|
|
315
|
+
Live-refresh monitor overview.
|
|
316
|
+
|
|
317
|
+
Options:
|
|
318
|
+
- `--interval <seconds>` refresh frequency (default `5`)
|
|
319
|
+
- `--iterations <n>` stop after `n` refreshes (`0` = infinite)
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
npm run cli -- monitor watch --interval 5
|
|
323
|
+
npm run cli -- monitor watch --interval 2 --iterations 10 --json
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## 9) Demo Commands
|
|
327
|
+
|
|
328
|
+
### demo multi-agent-devnet
|
|
329
|
+
Runs existing multi-agent devnet scenario (reused, not duplicated).
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
npm run cli -- demo multi-agent-devnet
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## 10) Audit / Config / Doctor
|
|
336
|
+
|
|
337
|
+
### audit
|
|
338
|
+
Show recent activity records.
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
npm run cli -- audit
|
|
342
|
+
npm run cli -- audit --limit 200
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### config show
|
|
346
|
+
Print effective runtime config.
|
|
347
|
+
|
|
348
|
+
```bash
|
|
349
|
+
npm run cli -- config show
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Also includes:
|
|
353
|
+
|
|
354
|
+
- `custodyModel`: local user custody mode for CLI-managed wallets
|
|
355
|
+
- `cliDataDir`: where the current install stores encrypted wallet state
|
|
356
|
+
- `walletKeySource`: `local-file` by default, or `env` when `PRKT_WALLET_MASTER_KEY` is supplied
|
|
357
|
+
- `policyExecutionModel`: high-level description of how policy gates agent actions
|
|
358
|
+
|
|
359
|
+
### doctor
|
|
360
|
+
Checks:
|
|
361
|
+
- cluster detection
|
|
362
|
+
- RPC connectivity
|
|
363
|
+
- custody model
|
|
364
|
+
- CLI data directory
|
|
365
|
+
- CLI data directory writability
|
|
366
|
+
- wallet key source
|
|
367
|
+
- policy execution model
|
|
368
|
+
- treasury key presence
|
|
369
|
+
- live mode flags
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
npm run cli -- doctor
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## 11) Completion
|
|
376
|
+
|
|
377
|
+
Generate shell completion scripts:
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
npm run cli -- completion bash
|
|
381
|
+
npm run cli -- completion zsh
|
|
382
|
+
npm run cli -- completion powershell
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Install examples:
|
|
386
|
+
|
|
387
|
+
Bash:
|
|
388
|
+
```bash
|
|
389
|
+
npm run cli -- completion bash > /etc/bash_completion.d/prkt
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
Zsh:
|
|
393
|
+
```bash
|
|
394
|
+
npm run cli -- completion zsh > ~/.zsh/completions/_prkt
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
PowerShell:
|
|
398
|
+
```powershell
|
|
399
|
+
npm run cli -- completion powershell | Out-File -FilePath $PROFILE.CurrentUserAllHosts -Append
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## 12) Explorer Links
|
|
403
|
+
|
|
404
|
+
Commands that submit transactions print signatures. Devnet explorer format:
|
|
405
|
+
|
|
406
|
+
```text
|
|
407
|
+
https://explorer.solana.com/tx/<signature>?cluster=devnet
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
## 13) Persistent State Files
|
|
411
|
+
|
|
412
|
+
CLI state is intentionally lightweight and local to the operator machine. The default custody model is one local encryption key per user install:
|
|
413
|
+
|
|
414
|
+
- Windows: `%APPDATA%/PRKT/`
|
|
415
|
+
- macOS: `~/Library/Application Support/PRKT/`
|
|
416
|
+
- Linux: `${XDG_DATA_HOME:-~/.local/share}/prkt/`
|
|
417
|
+
- Override for automation/tests: `PRKT_CLI_HOME`
|
|
418
|
+
|
|
419
|
+
Files stored there:
|
|
420
|
+
|
|
421
|
+
- `cli-wallets.json`: managed wallet registry
|
|
422
|
+
- `cli-agents.json`: agent metadata/status registry
|
|
423
|
+
- `cli-activity.json`: activity/audit records
|
|
424
|
+
- `platform-wallet-master.key`: local platform encryption key when `PRKT_WALLET_MASTER_KEY` is unset
|
|
425
|
+
|
|
426
|
+
These files are used for monitoring/audit convenience and do not replace on-chain truth.
|
|
427
|
+
|
|
428
|
+
## 14) Architecture Mapping
|
|
429
|
+
|
|
430
|
+
- Wallet Core (`src/core`):
|
|
431
|
+
- `wallet ...`
|
|
432
|
+
- `token ...`
|
|
433
|
+
- Policy + Sandbox (`src/policy`):
|
|
434
|
+
- `policy show`
|
|
435
|
+
- `policy validate-intent`
|
|
436
|
+
- Agent Runner (`src/agent`):
|
|
437
|
+
- `agent ...`
|
|
438
|
+
- Test dApp / Protocol Interaction (`src/demo`, `src/defi`, `src/scripts`):
|
|
439
|
+
- `demo multi-agent-devnet`
|
|
440
|
+
- `agent run --strategy universal-defi`
|
|
441
|
+
|
|
442
|
+
## 15) Example End-to-End Flows
|
|
443
|
+
|
|
444
|
+
### Flow A: Treasury bootstrap
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
npm run cli -- wallet create --name treasury
|
|
448
|
+
npm run cli -- wallet fund --name treasury --sol 2
|
|
449
|
+
npm run cli -- wallet balance --name treasury
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### Flow B: Demo token setup
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
npm run cli -- token mint-demo --authority treasury --decimals 6 --amount 1000
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Flow C: Agent operation and monitoring
|
|
459
|
+
|
|
460
|
+
```bash
|
|
461
|
+
npm run cli -- agent list
|
|
462
|
+
npm run cli -- agent run --agent treasury --strategy memo-heartbeat
|
|
463
|
+
npm run cli -- monitor overview
|
|
464
|
+
npm run cli -- monitor txs
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Flow D: Policy inspection
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
npm run cli -- policy show --agent treasury
|
|
471
|
+
npm run cli -- policy validate-intent --agent treasury --intent-file ./intent.json
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### Flow E: Provider preset management
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
npm run cli -- policy presets
|
|
478
|
+
npm run cli -- policy set-preset --agent treasury --preset guarded-live
|
|
479
|
+
npm run cli -- policy set-limits --agent treasury --allowed-close-destinations <wallet-pubkey>
|
|
480
|
+
npm run cli -- policy show --agent treasury
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
## 16) Troubleshooting
|
|
484
|
+
|
|
485
|
+
### `Wallet '<name>' not found`
|
|
486
|
+
Create the wallet first:
|
|
487
|
+
```bash
|
|
488
|
+
npm run cli -- wallet create --name <name>
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### `Unknown wallet/agent '<name>'`
|
|
492
|
+
Verify with:
|
|
493
|
+
```bash
|
|
494
|
+
npm run cli -- wallet list
|
|
495
|
+
npm run cli -- agent list
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
### Airdrop failure on devnet
|
|
499
|
+
RPC faucet may be rate-limited. Retry, lower amount, or switch devnet endpoint.
|
|
500
|
+
|
|
501
|
+
### Live DeFi path not used
|
|
502
|
+
Check:
|
|
503
|
+
- `UNIVERSAL_DEFI_LIVE_FIRST=true`
|
|
504
|
+
- `ENABLE_LIVE_SWAP_PATH=true` for Jupiter
|
|
505
|
+
- `ENABLE_LIVE_RAYDIUM_LP=true` + valid `raydium_lp.devnet.json` for Raydium LP
|
|
506
|
+
- `KORA_MOCK_MODE=false` for non-mock relayer path
|
|
507
|
+
|
|
508
|
+
### `bigint: Failed to load bindings` warning
|
|
509
|
+
This is a known optional native binding warning from dependency stack; tests/CLI still run in pure JS mode.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# PRKT CLI Quickstart
|
|
2
|
+
|
|
3
|
+
Fast path for judges and reviewers.
|
|
4
|
+
|
|
5
|
+
For the full end-to-end guide, see:
|
|
6
|
+
- [FULL_DOCUMENTATION.md](./FULL_DOCUMENTATION.md)
|
|
7
|
+
|
|
8
|
+
## 0) Prerequisites
|
|
9
|
+
|
|
10
|
+
- Node 18+
|
|
11
|
+
- `.env` configured for devnet
|
|
12
|
+
- configured `REMOTE_SIGNER_*` for production-style signing, or funded `AGENT_PRIVATE_KEY` for local devnet/demo use only
|
|
13
|
+
|
|
14
|
+
## 1) Install and sanity check
|
|
15
|
+
|
|
16
|
+
Published CLI:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g @prktsol/prkt
|
|
20
|
+
prkt --help
|
|
21
|
+
prkt init
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
From source:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install
|
|
28
|
+
npm run cli -- --help
|
|
29
|
+
npm run cli -- init
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 2) Create wallets
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm run cli -- wallet create --name treasury
|
|
36
|
+
npm run cli -- wallet create --name agent-a
|
|
37
|
+
npm run cli -- wallet list
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 3) Fund treasury on devnet
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm run cli -- wallet fund --name treasury --sol 2
|
|
44
|
+
npm run cli -- wallet balance --name treasury
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 4) Mint demo SPL token
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm run cli -- token mint-demo --authority treasury --decimals 6 --amount 1000
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 5) Run agent action
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm run cli -- agent run --agent treasury --strategy memo-heartbeat
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 6) Run multi-agent devnet demo
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm run cli -- demo multi-agent-devnet
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 7) Monitor operations
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm run cli -- monitor overview
|
|
69
|
+
npm run cli -- monitor txs
|
|
70
|
+
npm run cli -- monitor watch --interval 5
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 8) Inspect policy
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npm run cli -- policy show --agent treasury
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Validate an intent file:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm run cli -- policy validate-intent --agent treasury --intent-file ./intent.json
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 9) Doctor and config checks
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm run cli -- doctor
|
|
89
|
+
npm run cli -- config show
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Published CLI equivalents:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
prkt doctor
|
|
96
|
+
prkt config show
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 10) JSON mode for automation
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npm run cli -- --json monitor overview
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Useful links
|
|
106
|
+
|
|
107
|
+
- Full CLI docs: [CLI.md](./CLI.md)
|
|
108
|
+
- Project overview: [README.md](./README.md)
|
package/COMPATIBILITY.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Compatibility Matrix
|
|
2
|
+
|
|
3
|
+
## Cluster Support
|
|
4
|
+
|
|
5
|
+
| Cluster | Status | Notes |
|
|
6
|
+
|---------|--------|-------|
|
|
7
|
+
| Devnet | Supported | Default. All live demos and tests target devnet |
|
|
8
|
+
| Testnet | Untested | Should work in core paths but not validated |
|
|
9
|
+
| Mainnet | Blocked | Requires completion of mainnet deployment gate items |
|
|
10
|
+
| Localnet | Partial | Wallet core works; protocol adapters require live RPC |
|
|
11
|
+
|
|
12
|
+
## Protocol Support
|
|
13
|
+
|
|
14
|
+
| Protocol | Capability | Live Status | Simulated Status |
|
|
15
|
+
|----------|-----------|-------------|-----------------|
|
|
16
|
+
| Jupiter | Trade (swap) | Devnet live | Memo fallback |
|
|
17
|
+
| Orca | LP (Whirlpools) | Devnet live via public pool | Not implemented |
|
|
18
|
+
| Raydium | LP (add liquidity) | Devnet live | Memo fallback |
|
|
19
|
+
| Raydium | Yield | Not implemented | Memo fallback |
|
|
20
|
+
| Marinade | Staking | Devnet live | Memo fallback |
|
|
21
|
+
| Kamino | Lending / Borrowing | Devnet live via config | Memo fallback |
|
|
22
|
+
| Kamino | Yield | Not implemented | Memo fallback |
|
|
23
|
+
|
|
24
|
+
## Command Modes
|
|
25
|
+
|
|
26
|
+
| Command | Mode | Cluster |
|
|
27
|
+
|---------|------|---------|
|
|
28
|
+
| `npm run demo:autonomous-agent-wallet:devnet` | `LIVE` | Devnet |
|
|
29
|
+
| `npm run wallet:devnet` | `LIVE` | Devnet |
|
|
30
|
+
| `npm run defi:stake:devnet -- 0.15` | `LIVE` | Devnet |
|
|
31
|
+
| `npm run defi:orca:devnet -- 0.05` | `LIVE` | Devnet |
|
|
32
|
+
| `npm run defi:lp:devnet` | `LIVE` | Devnet |
|
|
33
|
+
| `npm run defi:kamino:devnet -- deposit` | `LIVE` | Devnet |
|
|
34
|
+
| `npm run defi:kamino:devnet -- borrow` | `LIVE` | Devnet |
|
|
35
|
+
| `npm run demo:multi-agent:devnet` | `LIVE` | Devnet |
|
|
36
|
+
| `npm run simulate-attack` | `LIVE` | Devnet |
|
|
37
|
+
| `npm run stress:agents` | `LIVE` | Devnet |
|
|
38
|
+
| `npm run wallet:gasless` | `LIVE` (if `KORA_MOCK_MODE=false`) | Devnet |
|
|
39
|
+
| `npm run defi:universal` | `SIMULATED` | Any |
|
|
40
|
+
| `npm run agent:defi:universal` | `SIMULATED` | Any |
|
|
41
|
+
| `npm run defi:borrow` | `SIMULATED` | Any |
|
|
42
|
+
| `npm run defi:all` | `SIMULATED` | Any |
|
|
43
|
+
| `npm run defi:lp` | `SIMULATED` | Any |
|
|
44
|
+
| `npm run defi:stake` | `SIMULATED` | Any |
|
|
45
|
+
| `npm run defi:yield` | `SIMULATED` | Any |
|
|
46
|
+
| `npm run trade:simulate` | `SIMULATED` | Any |
|
|
47
|
+
|
|
48
|
+
## Runtime Requirements
|
|
49
|
+
|
|
50
|
+
| Requirement | Version |
|
|
51
|
+
|-------------|---------|
|
|
52
|
+
| Node.js | >= 20.x |
|
|
53
|
+
| npm | >= 9.x |
|
|
54
|
+
| TypeScript | 5.9.x (dev dependency) |
|
|
55
|
+
| OS | Windows, macOS, Linux |
|
|
56
|
+
|
|
57
|
+
## Dependencies
|
|
58
|
+
|
|
59
|
+
| Package | Version | Purpose |
|
|
60
|
+
|---------|---------|---------|
|
|
61
|
+
| `@solana/web3.js` | ^1.98.4 | Solana RPC, transactions |
|
|
62
|
+
| `@solana/spl-token` | ^0.4.14 | SPL token operations |
|
|
63
|
+
| `@raydium-io/raydium-sdk-v2` | ^0.1.95-alpha | Raydium LP instructions |
|
|
64
|
+
| `@kamino-finance/klend-sdk` | ^7.3.20 | Kamino lending / borrowing instructions |
|
|
65
|
+
| `@marinade.finance/marinade-ts-sdk` | ^5.0.18 | Marinade staking instructions |
|
|
66
|
+
| `@orca-so/whirlpools-sdk` | ^0.20.0 | Orca Whirlpool LP instructions |
|
|
67
|
+
| `@orca-so/common-sdk` | ^0.7.0 | Orca transaction helpers |
|
|
68
|
+
| `solana-agent-kit` | ^1.4.9 | Agent toolkit integration |
|
|
69
|
+
| `commander` | ^12.1.0 | CLI framework |
|
|
70
|
+
| `dotenv` | ^16.6.1 | Environment config |
|
|
71
|
+
| `chalk` | ^4.1.2 | Terminal colors |
|
|
72
|
+
|
|
73
|
+
## Environment Variables
|
|
74
|
+
|
|
75
|
+
| Variable | Required | Default | Description |
|
|
76
|
+
|----------|----------|---------|-------------|
|
|
77
|
+
| `SOLANA_RPC_URL` | No | `https://api.devnet.solana.com` | Primary RPC endpoint |
|
|
78
|
+
| `SOLANA_RPC_FALLBACK_URL` | No | none | Failover RPC endpoint |
|
|
79
|
+
| `AGENT_PRIVATE_KEY` | Devnet only | `[]` | 64-integer JSON array (devnet/demo) |
|
|
80
|
+
| `DEVNET_TREASURY_PRIVATE_KEY` | No | `[]` | Optional funded devnet treasury for generated wallet top-ups |
|
|
81
|
+
| `REMOTE_SIGNER_URL` | Production | none | Remote signer HTTPS endpoint |
|
|
82
|
+
| `REMOTE_SIGNER_BEARER_TOKEN` | Production | none | Bearer auth token |
|
|
83
|
+
| `REMOTE_SIGNER_PUBKEY` | Production | none | Signer public key |
|
|
84
|
+
| `USDC_MINT` | No | devnet USDC | Token mint address |
|
|
85
|
+
| `KORA_RPC_URL` | No | `https://kora.devnet.lazorkit.com` | Kora gasless RPC |
|
|
86
|
+
| `KORA_MOCK_MODE` | No | `true` | Mock gasless signing |
|
|
87
|
+
| `JUPITER_API_BASE_URL` | No | `https://lite-api.jup.ag` | Jupiter API |
|
|
88
|
+
| `ENABLE_LIVE_SWAP_PATH` | No | `false` | Enable live Jupiter swaps |
|
|
89
|
+
| `ENABLE_LIVE_RAYDIUM_LP` | No | `false` | Enable live Raydium LP |
|
|
90
|
+
| `ENABLE_LIVE_KAMINO` | No | `false` | Enable live Kamino lending / borrowing |
|
|
91
|
+
| `ENABLE_LIVE_MARINADE` | No | `false` | Enable live Marinade staking |
|
|
92
|
+
| `KAMINO_LIVE_CONFIG_PATH` | No | `kamino_live.json` | Path to Kamino live config |
|
|
93
|
+
| `PRKT_AGENT_NAME` | No | script-specific default | Persistent agent/wallet name for autonomous and live DeFi scripts |
|
|
94
|
+
| `PRKT_OWNER_ID` | No | none | Optional owner id stored on auto-provisioned agents |
|
|
95
|
+
| `PRKT_WALLET_MASTER_KEY` | Recommended for live | local generated file fallback | 32-byte base64 or 64-char hex key used to decrypt managed agent wallets autonomously |
|
|
96
|
+
| `UNIVERSAL_DEFI_LIVE_FIRST` | No | `true` | Try live paths before fallback |
|
|
97
|
+
| `EXTRA_WHITELISTED_PROGRAMS` | No | none | Comma-separated program IDs |
|
|
98
|
+
| `POLICY_SESSION_TTL_MINUTES` | No | `60` | Session TTL (1-1440) |
|
|
99
|
+
| `POLICY_EMERGENCY_LOCK` | No | none | Set `true` to engage kill switch |
|
|
100
|
+
| `POLICY_EMERGENCY_LOCK_PATH` | No | `./emergency_lock.json` | Path to lock file |
|
|
101
|
+
| `POLICY_EMERGENCY_COMMAND_PATH` | No | `./emergency_command.json` | Path to signed command |
|
|
102
|
+
| `POLICY_EMERGENCY_ADMIN_SECRET` | No | none | HMAC secret for signed commands |
|
|
103
|
+
| `POLICY_EMERGENCY_MAX_AGE_SECONDS` | No | `600` | Max age for signed commands |
|