@aura-protocol/cli 0.1.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 (78) hide show
  1. package/README.md +307 -0
  2. package/bin/aura.js +8 -0
  3. package/dist/commands/confidential.d.ts +2 -0
  4. package/dist/commands/confidential.js +564 -0
  5. package/dist/commands/confidential.js.map +1 -0
  6. package/dist/commands/config.d.ts +2 -0
  7. package/dist/commands/config.js +123 -0
  8. package/dist/commands/config.js.map +1 -0
  9. package/dist/commands/dashboard.d.ts +2 -0
  10. package/dist/commands/dashboard.js +29 -0
  11. package/dist/commands/dashboard.js.map +1 -0
  12. package/dist/commands/dwallet.d.ts +2 -0
  13. package/dist/commands/dwallet.js +131 -0
  14. package/dist/commands/dwallet.js.map +1 -0
  15. package/dist/commands/execution.d.ts +2 -0
  16. package/dist/commands/execution.js +261 -0
  17. package/dist/commands/execution.js.map +1 -0
  18. package/dist/commands/governance.d.ts +2 -0
  19. package/dist/commands/governance.js +169 -0
  20. package/dist/commands/governance.js.map +1 -0
  21. package/dist/commands/helpers.d.ts +79 -0
  22. package/dist/commands/helpers.js +219 -0
  23. package/dist/commands/helpers.js.map +1 -0
  24. package/dist/commands/treasury.d.ts +2 -0
  25. package/dist/commands/treasury.js +319 -0
  26. package/dist/commands/treasury.js.map +1 -0
  27. package/dist/config.d.ts +35 -0
  28. package/dist/config.js +96 -0
  29. package/dist/config.js.map +1 -0
  30. package/dist/context.d.ts +37 -0
  31. package/dist/context.js +57 -0
  32. package/dist/context.js.map +1 -0
  33. package/dist/dashboard.d.ts +7 -0
  34. package/dist/dashboard.js +95 -0
  35. package/dist/dashboard.js.map +1 -0
  36. package/dist/domain.d.ts +16 -0
  37. package/dist/domain.js +86 -0
  38. package/dist/domain.js.map +1 -0
  39. package/dist/format.d.ts +9 -0
  40. package/dist/format.js +92 -0
  41. package/dist/format.js.map +1 -0
  42. package/dist/ika.d.ts +76 -0
  43. package/dist/ika.js +178 -0
  44. package/dist/ika.js.map +1 -0
  45. package/dist/index.d.ts +3 -0
  46. package/dist/index.js +43 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/output.d.ts +32 -0
  49. package/dist/output.js +134 -0
  50. package/dist/output.js.map +1 -0
  51. package/dist/protocol.d.ts +99 -0
  52. package/dist/protocol.js +353 -0
  53. package/dist/protocol.js.map +1 -0
  54. package/dist/sdk.d.ts +6 -0
  55. package/dist/sdk.js +6 -0
  56. package/dist/sdk.js.map +1 -0
  57. package/dist/treasury-view.d.ts +11 -0
  58. package/dist/treasury-view.js +103 -0
  59. package/dist/treasury-view.js.map +1 -0
  60. package/dist/vendor/encrypt/generated/grpc/encrypt_service.d.ts +195 -0
  61. package/dist/vendor/encrypt/generated/grpc/encrypt_service.js +514 -0
  62. package/dist/vendor/encrypt/generated/grpc/encrypt_service.js.map +1 -0
  63. package/dist/vendor/encrypt/grpc.d.ts +70 -0
  64. package/dist/vendor/encrypt/grpc.js +108 -0
  65. package/dist/vendor/encrypt/grpc.js.map +1 -0
  66. package/dist/vendor/ika/bcs-types.d.ts +1045 -0
  67. package/dist/vendor/ika/bcs-types.js +185 -0
  68. package/dist/vendor/ika/bcs-types.js.map +1 -0
  69. package/dist/vendor/ika/generated/grpc/ika_dwallet.d.ts +141 -0
  70. package/dist/vendor/ika/generated/grpc/ika_dwallet.js +531 -0
  71. package/dist/vendor/ika/generated/grpc/ika_dwallet.js.map +1 -0
  72. package/dist/vendor/ika/grpc.d.ts +16 -0
  73. package/dist/vendor/ika/grpc.js +129 -0
  74. package/dist/vendor/ika/grpc.js.map +1 -0
  75. package/dist/wallet.d.ts +2 -0
  76. package/dist/wallet.js +21 -0
  77. package/dist/wallet.js.map +1 -0
  78. package/package.json +54 -0
package/README.md ADDED
@@ -0,0 +1,307 @@
1
+ # @aura/cli
2
+
3
+ Terminal interface for the AURA autonomous treasury program on Solana.
4
+
5
+ Built on top of `@aura/sdk-ts` with full integration of the Ika Encrypt and dWallet
6
+ gRPC networks — the CLI drives the complete confidential proposal lifecycle end-to-end,
7
+ including automatic FHE ciphertext creation, policy decryption, and dWallet co-signing.
8
+
9
+ ---
10
+
11
+ ## Features
12
+
13
+ - Config-driven wallet and RPC resolution via `~/.aura/config.json`
14
+ - Interactive prompts when flags are omitted; fully scriptable with flags
15
+ - Auto-encryption of guardrail and transaction amounts via `@encrypt.xyz/pre-alpha-solana-client`
16
+ - Automatic dWallet presign + sign via `@ika.xyz/pre-alpha-solana-client`
17
+ - Readable tables, spinners, and actionable error messages
18
+ - `--json` output for piping and scripting
19
+ - `--dry-run` to preview instructions without sending
20
+ - Full-screen `ink` dashboard for live treasury monitoring
21
+
22
+ ---
23
+
24
+ ## Prerequisites
25
+
26
+ - Node.js >= 20
27
+ - A funded Solana devnet wallet at `~/.config/solana/id.json`
28
+ - `solana airdrop 2 --url devnet`
29
+ - Network access to Ika devnet gRPC services:
30
+ - Encrypt: `pre-alpha-dev-1.encrypt.ika-network.net:443`
31
+ - dWallet: `pre-alpha-dev-1.ika.ika-network.net:443`
32
+
33
+ ---
34
+
35
+ ## Setup
36
+
37
+ ```bash
38
+ # From the monorepo root — build the SDK first, then the CLI
39
+ cd packages/sdk-ts && npm run build
40
+ cd ../cli && npm install && npm run build
41
+
42
+ # Link globally
43
+ npm link
44
+
45
+ # Or run directly
46
+ node bin/aura.js --help
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Configuration
52
+
53
+ ```bash
54
+ # Interactive setup — writes ~/.aura/config.json
55
+ aura config init
56
+
57
+ # Show resolved config (all sources merged)
58
+ aura config show
59
+
60
+ # Set individual values
61
+ aura config set --rpc-url https://devnet.helius-rpc.com/?api-key=YOUR_KEY
62
+ aura config set --wallet ~/.config/solana/id.json
63
+ ```
64
+
65
+ Config resolution order (highest wins):
66
+ 1. CLI flags (`--rpc-url`, `--wallet`, `--program-id`)
67
+ 2. Environment variables (`AURA_RPC_URL`, `AURA_WALLET_PATH`, `AURA_PROGRAM_ID`)
68
+ 3. Config file (`~/.aura/config.json`)
69
+ 4. Built-in defaults (devnet RPC, `~/.config/solana/id.json`)
70
+
71
+ ---
72
+
73
+ ## Commands
74
+
75
+ ### Treasury
76
+
77
+ ```bash
78
+ # Create a treasury with policy limits
79
+ aura treasury create --agent-id my-agent --daily-limit 10000 --per-tx-limit 1000
80
+
81
+ # Show full treasury state
82
+ aura treasury show --agent-id my-agent
83
+ aura treasury show --agent-id my-agent --watch # live-refresh every 5s
84
+
85
+ # List all treasuries owned by your wallet
86
+ aura treasury list
87
+
88
+ # Propose a public (non-encrypted) transaction
89
+ aura treasury propose --agent-id my-agent --amount 500 --chain ethereum --recipient 0xdeadbeef...
90
+
91
+ # Pause / unpause execution
92
+ aura treasury pause --agent-id my-agent
93
+ aura treasury pause --agent-id my-agent --unpause
94
+
95
+ # Cancel the current pending transaction
96
+ aura treasury cancel --agent-id my-agent
97
+ ```
98
+
99
+ ### dWallet
100
+
101
+ ```bash
102
+ # Register a dWallet reference (basic — no live signing)
103
+ aura dwallet register --agent-id my-agent \
104
+ --chain ethereum \
105
+ --dwallet-id dwallet-abc123 \
106
+ --address 0xdeadbeef... \
107
+ --balance 5000
108
+
109
+ # Register with live Ika signing metadata (required for execute/finalize)
110
+ aura dwallet register --agent-id my-agent \
111
+ --chain ethereum \
112
+ --dwallet-id dwallet-abc123 \
113
+ --address 0xdeadbeef... \
114
+ --balance 5000 \
115
+ --dwallet-account <pda> \
116
+ --authorized-user <pubkey> \
117
+ --message-metadata-digest <32-byte-hex> \
118
+ --public-key-hex <pubkey-hex>
119
+
120
+ # List registered dWallets
121
+ aura dwallet list --agent-id my-agent
122
+ ```
123
+
124
+ ### Confidential (FHE)
125
+
126
+ The confidential flow uses the Ika Encrypt gRPC network to create and decrypt FHE
127
+ ciphertexts. All encryption happens automatically — no manual ciphertext management needed.
128
+
129
+ ```bash
130
+ # Ensure the Encrypt deposit account exists (required before any confidential operation)
131
+ aura confidential deposit ensure
132
+
133
+ # Configure scalar guardrails — auto-encrypts the three limit values via Ika Encrypt
134
+ aura confidential guardrails scalar \
135
+ --agent-id my-agent \
136
+ --daily-limit 10000 \
137
+ --per-tx-limit 1000 \
138
+ --spent-today 0
139
+
140
+ # Or attach pre-created ciphertext accounts directly
141
+ aura confidential guardrails scalar \
142
+ --agent-id my-agent \
143
+ --daily-limit-ciphertext <pk> \
144
+ --per-tx-ciphertext <pk> \
145
+ --spent-today-ciphertext <pk>
146
+
147
+ # Configure vector guardrails (single EUint64Vector ciphertext)
148
+ aura confidential guardrails vector \
149
+ --agent-id my-agent \
150
+ --guardrail-ciphertext <pk>
151
+
152
+ # Show confidential guardrails and pending state
153
+ aura confidential status --agent-id my-agent
154
+
155
+ # Propose a confidential transaction — auto-encrypts the amount via Ika Encrypt
156
+ aura confidential propose \
157
+ --agent-id my-agent \
158
+ --amount 250 \
159
+ --chain ethereum \
160
+ --recipient 0xdeadbeef... \
161
+ --wait # waits for the output ciphertext to be verified on-chain
162
+
163
+ # Or pass a pre-created amount ciphertext
164
+ aura confidential propose \
165
+ --agent-id my-agent \
166
+ --amount 250 \
167
+ --chain ethereum \
168
+ --recipient 0xdeadbeef... \
169
+ --amount-ciphertext <pk>
170
+
171
+ # Request decryption of the policy output
172
+ aura confidential request-decryption --agent-id my-agent --wait
173
+
174
+ # Confirm the decryption result on-chain (shows approved/denied + violation code)
175
+ aura confidential confirm-decryption --agent-id my-agent
176
+ ```
177
+
178
+ ### Execution
179
+
180
+ ```bash
181
+ # Execute the pending proposal
182
+ # For approved proposals: submits execute_pending, then automatically drives
183
+ # the dWallet presign + sign flow via the Ika dWallet gRPC network
184
+ aura execution execute --agent-id my-agent
185
+
186
+ # --wait: waits for the message approval account to be created
187
+ # --wait-signed: waits for the full dWallet signature
188
+ aura execution execute --agent-id my-agent --wait
189
+ aura execution execute --agent-id my-agent --wait-signed
190
+
191
+ # Finalize after dWallet signing is complete
192
+ aura execution finalize --agent-id my-agent
193
+
194
+ # Watch execution state live
195
+ aura execution watch --agent-id my-agent
196
+ aura execution watch --agent-id my-agent --interval 3
197
+ ```
198
+
199
+ ### Governance
200
+
201
+ ```bash
202
+ # Configure emergency guardian multisig
203
+ aura governance multisig \
204
+ --agent-id my-agent \
205
+ --required 2 \
206
+ --guardians pk1,pk2,pk3
207
+
208
+ # Configure agent swarm with shared spending pool
209
+ aura governance swarm \
210
+ --agent-id my-agent \
211
+ --swarm-id alpha \
212
+ --members agent-1,agent-2,agent-3 \
213
+ --pool-limit 50000
214
+
215
+ # Guardian proposes a daily limit increase
216
+ aura governance override propose \
217
+ --agent-id my-agent \
218
+ --new-daily-limit 25000
219
+
220
+ # Guardian co-signs the override proposal
221
+ aura governance override collect --agent-id my-agent
222
+ ```
223
+
224
+ ### Dashboard
225
+
226
+ ```bash
227
+ # Full-screen live treasury dashboard
228
+ aura dashboard --agent-id my-agent
229
+
230
+ # Controls: r = refresh q / Esc = quit
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Full Confidential Flow (end-to-end)
236
+
237
+ ```bash
238
+ # 1. Create treasury
239
+ aura treasury create --agent-id my-agent --daily-limit 10000 --per-tx-limit 1000
240
+
241
+ # 2. Register dWallet with live signing metadata
242
+ aura dwallet register --agent-id my-agent --chain ethereum \
243
+ --dwallet-id <id> --address <addr> --balance 5000 \
244
+ --dwallet-account <pda> --authorized-user <pubkey> \
245
+ --message-metadata-digest <hex> --public-key-hex <hex>
246
+
247
+ # 3. Ensure Encrypt deposit
248
+ aura confidential deposit ensure
249
+
250
+ # 4. Configure guardrails (auto-encrypts via Ika Encrypt gRPC)
251
+ aura confidential guardrails scalar \
252
+ --agent-id my-agent --daily-limit 10000 --per-tx-limit 1000
253
+
254
+ # 5. Propose confidential transaction (auto-encrypts amount)
255
+ aura confidential propose \
256
+ --agent-id my-agent --amount 250 --chain ethereum \
257
+ --recipient 0xdeadbeef... --wait
258
+
259
+ # 6. Request decryption
260
+ aura confidential request-decryption --agent-id my-agent --wait
261
+
262
+ # 7. Confirm decryption (shows approved/denied)
263
+ aura confidential confirm-decryption --agent-id my-agent
264
+
265
+ # 8. Execute (drives dWallet presign + sign automatically)
266
+ aura execution execute --agent-id my-agent --wait-signed
267
+
268
+ # 9. Finalize
269
+ aura execution finalize --agent-id my-agent
270
+ ```
271
+
272
+ ---
273
+
274
+ ## Global Flags
275
+
276
+ ```
277
+ --rpc-url <url> Override RPC endpoint
278
+ --wallet <path> Override keypair file path
279
+ --program-id <id> Override program ID
280
+ --json Output raw JSON (for piping)
281
+ --quiet Suppress all output except errors
282
+ --dry-run Build and display the transaction without sending
283
+ --help Show help
284
+ ```
285
+
286
+ ---
287
+
288
+ ## Environment Variables
289
+
290
+ ```bash
291
+ AURA_RPC_URL="https://devnet.helius-rpc.com/?api-key=YOUR_KEY"
292
+ AURA_DEVNET_RPC_URL="https://devnet.helius-rpc.com/?api-key=YOUR_KEY"
293
+ AURA_WALLET_PATH="/path/to/keypair.json"
294
+ PAYER_KEYPAIR="/path/to/keypair.json"
295
+ AURA_PROGRAM_ID="G4XjdmHtwwuTdw7VxWqTuTaL8WkZTKnCEnyaV5V6zgVW"
296
+ AURA_DEFAULT_AGENT_ID="my-agent"
297
+ ```
298
+
299
+ ---
300
+
301
+ ## Build and Test
302
+
303
+ ```bash
304
+ npm install
305
+ npm run build
306
+ npm test
307
+ ```
package/bin/aura.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ import("../dist/index.js")
4
+ .then((module) => module.main())
5
+ .catch((error) => {
6
+ console.error(error instanceof Error ? error.message : String(error));
7
+ process.exitCode = 1;
8
+ });
@@ -0,0 +1,2 @@
1
+ import { type Command } from "commander";
2
+ export declare function registerConfidentialCommands(program: Command): void;