zk-agent-cli 0.1.0-rc.0 → 0.1.0-rc.1
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 +125 -191
- package/dist/index.js +335 -41
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,37 +1,11 @@
|
|
|
1
1
|
# zk-agent-cli
|
|
2
2
|
|
|
3
|
-
`zk-agent-cli` is the packaged
|
|
4
|
-
and zkSync Sepolia.
|
|
3
|
+
`zk-agent-cli` is the packaged terminal CLI for the zk-agent operator path on
|
|
4
|
+
zkSync Era and zkSync Sepolia.
|
|
5
5
|
|
|
6
|
-
This
|
|
7
|
-
repo architecture, contributor state, or project planning context, use the root
|
|
8
|
-
repository docs instead of this package manual.
|
|
6
|
+
This file is the canonical operator manual for CLI users.
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- local-first wallet/session storage
|
|
13
|
-
- `next`-first operator guidance
|
|
14
|
-
- relay-backed approval and reapproval
|
|
15
|
-
- workflow orchestration for send, swap, bridge, deposit, and withdraw
|
|
16
|
-
- machine-readable JSON output for agent callers
|
|
17
|
-
|
|
18
|
-
## Public Entry Points
|
|
19
|
-
|
|
20
|
-
Choose the entrypoint that matches the environment.
|
|
21
|
-
|
|
22
|
-
If you are installing this repository into a compatible agent harness instead
|
|
23
|
-
of using the CLI directly, prefer the repo skill surface:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npx skills add https://github.com/AgiWeb3/zk-agent-cli
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
This repo currently ships a repository skill bundle for compatible harnesses.
|
|
30
|
-
The repository root now also ships a native ChatGPT/Codex plugin manifest at
|
|
31
|
-
`.codex-plugin/plugin.json`, but that plugin source belongs to the repository
|
|
32
|
-
surface rather than this published npm tarball.
|
|
33
|
-
|
|
34
|
-
For direct terminal use, install the packaged CLI:
|
|
8
|
+
## Install
|
|
35
9
|
|
|
36
10
|
One-shot execution:
|
|
37
11
|
|
|
@@ -46,24 +20,22 @@ npm install -g zk-agent-cli
|
|
|
46
20
|
zk-agent --help
|
|
47
21
|
```
|
|
48
22
|
|
|
49
|
-
The package also ships the
|
|
23
|
+
The package also ships the alias:
|
|
50
24
|
|
|
51
25
|
```bash
|
|
52
26
|
zksync-agent --help
|
|
53
27
|
```
|
|
54
28
|
|
|
55
|
-
##
|
|
29
|
+
## Defaults and prerequisites
|
|
56
30
|
|
|
57
|
-
- Node.js `>=24`
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
`http://localhost:4444`. Override it with
|
|
62
|
-
`zk-agent setup --connector-url <url>` when needed.
|
|
63
|
-
- The CLI auto-loads `.env` from the current working directory.
|
|
31
|
+
- Node.js `>=24`
|
|
32
|
+
- the default chain is `zksync-sepolia`
|
|
33
|
+
- the default local approval callback is `http://localhost:4444`
|
|
34
|
+
- the CLI auto-loads `.env` from the current working directory
|
|
64
35
|
|
|
65
|
-
You do not need a custom `.env` just to run `setup`, `next`, or
|
|
66
|
-
wallet request. You usually do need
|
|
36
|
+
You do not need a custom `.env` just to run `setup`, `next`, `doctor`, or
|
|
37
|
+
create a wallet request. You usually do need RPC values for live reads or
|
|
38
|
+
broadcasts.
|
|
67
39
|
|
|
68
40
|
Most relevant environment variables:
|
|
69
41
|
|
|
@@ -74,25 +46,9 @@ ZK_AGENT_TOKEN_DIRECTORY_ROOT=
|
|
|
74
46
|
ZK_AGENT_STORAGE_DIR=
|
|
75
47
|
```
|
|
76
48
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
- `ZKSYNC_SEPOLIA_RPC_URL` for explicit zkSync Sepolia reads/broadcasts
|
|
80
|
-
- `ETHEREUM_SEPOLIA_RPC_URL` for L1 deposit/bridge follow-up flows on Sepolia
|
|
81
|
-
- `ZK_AGENT_TOKEN_DIRECTORY_ROOT` when you want local token-directory symbol
|
|
82
|
-
resolution
|
|
83
|
-
- `ZK_AGENT_STORAGE_DIR` only when you need to override the default local
|
|
84
|
-
storage path
|
|
85
|
-
|
|
86
|
-
## Shortest Path
|
|
87
|
-
|
|
88
|
-
Current validated first-run baseline:
|
|
49
|
+
## Fastest verified path
|
|
89
50
|
|
|
90
|
-
|
|
91
|
-
- the local approval path expects the connector UI at `http://localhost:4444`
|
|
92
|
-
- override `--default-chain` or `--connector-url` only when you intentionally
|
|
93
|
-
target another chain or connector deployment
|
|
94
|
-
|
|
95
|
-
Fresh setup:
|
|
51
|
+
Use this path unless the task explicitly needs a lower-level command:
|
|
96
52
|
|
|
97
53
|
```bash
|
|
98
54
|
zk-agent setup
|
|
@@ -102,227 +58,205 @@ zk-agent next
|
|
|
102
58
|
zk-agent workflow pay --wallet main --to <address> --amount <amount>
|
|
103
59
|
```
|
|
104
60
|
|
|
105
|
-
|
|
106
|
-
|
|
61
|
+
Interpretation:
|
|
62
|
+
|
|
63
|
+
- `setup` writes local defaults
|
|
64
|
+
- `next` gives the shortest valid follow-up step
|
|
65
|
+
- `wallet create --await-local` is the preferred local approval path
|
|
66
|
+
- `workflow pay` is the flagship zkSync-native AA native-send path
|
|
67
|
+
|
|
68
|
+
If readiness is unclear before you choose a fix, use:
|
|
107
69
|
|
|
108
70
|
```bash
|
|
109
|
-
zk-agent
|
|
110
|
-
zk-agent wallet create --relay-url <relay-url> --wait-relay --prompt-code
|
|
111
|
-
zk-agent next
|
|
71
|
+
zk-agent doctor
|
|
112
72
|
```
|
|
113
73
|
|
|
114
|
-
|
|
115
|
-
It inspects saved config, wallet approval metadata, and local signer state
|
|
116
|
-
without live RPC reads, and `--relay-url` only makes the remote fallback
|
|
117
|
-
commands concrete.
|
|
74
|
+
## Existing wallet recovery
|
|
118
75
|
|
|
119
|
-
If
|
|
120
|
-
when approval is missing or expired, then return to `zk-agent next`. Use
|
|
121
|
-
`wallet signer attach` when approval is still present but the local execution
|
|
122
|
-
signer is missing:
|
|
76
|
+
If the wallet already exists and approval is missing or expired:
|
|
123
77
|
|
|
124
78
|
```bash
|
|
125
79
|
zk-agent wallet reapprove --name main --await-local
|
|
126
80
|
zk-agent next
|
|
127
|
-
zk-agent wallet signer attach --name main --private-key <hex>
|
|
128
|
-
zk-agent next
|
|
129
81
|
```
|
|
130
82
|
|
|
131
|
-
|
|
83
|
+
If approval is still present but the local execution signer is missing:
|
|
132
84
|
|
|
133
85
|
```bash
|
|
134
|
-
zk-agent
|
|
86
|
+
zk-agent wallet signer attach --name main --private-key <hex>
|
|
87
|
+
zk-agent next
|
|
135
88
|
```
|
|
136
89
|
|
|
137
|
-
|
|
90
|
+
Use these inspection commands when the blocker is wallet-specific:
|
|
138
91
|
|
|
139
92
|
```bash
|
|
140
|
-
zk-agent
|
|
141
|
-
zk-agent
|
|
93
|
+
zk-agent wallet status --name main
|
|
94
|
+
zk-agent wallet next --name main
|
|
142
95
|
```
|
|
143
96
|
|
|
144
|
-
|
|
145
|
-
`daily-spend-limit` for profile-specific policy experiments, not as the main
|
|
146
|
-
operator baseline.
|
|
97
|
+
## Remote approval
|
|
147
98
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
through the intent-scoped approval path, and defaults to the validated
|
|
151
|
-
approval-based paymaster mode unless you override it.
|
|
152
|
-
When that approval-based path still needs a fee-token candidate, recover with
|
|
153
|
-
`zk-agent tokens --chain zksync-sepolia --role paymaster-fee-token` and
|
|
154
|
-
`zk-agent resolve-token --chain zksync-sepolia --symbol <symbol> --role paymaster-fee-token`.
|
|
99
|
+
Use the relay-backed path only when the browser is not colocated with the
|
|
100
|
+
terminal:
|
|
155
101
|
|
|
156
|
-
|
|
102
|
+
```bash
|
|
103
|
+
zk-agent relay inspect --relay-url <relay-url>
|
|
104
|
+
zk-agent wallet create --relay-url <relay-url> --wait-relay --prompt-code
|
|
105
|
+
zk-agent next
|
|
106
|
+
```
|
|
157
107
|
|
|
158
|
-
|
|
159
|
-
needs token context:
|
|
108
|
+
For an existing wallet:
|
|
160
109
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
symbol-first discovery before choosing an explicit token address
|
|
166
|
-
- `zk-agent tokens --chain zksync-sepolia --role paymaster-fee-token` and
|
|
167
|
-
`zk-agent resolve-token --chain zksync-sepolia --symbol <symbol> --role paymaster-fee-token`
|
|
168
|
-
for approval-based paymaster fee-token discovery on the flagship pay path
|
|
169
|
-
- `zk-agent defaults` for the machine-readable registry/defaults catalog:
|
|
170
|
-
tracked token roles, paymaster metadata, source order, and validated/fallback
|
|
171
|
-
route metadata
|
|
110
|
+
```bash
|
|
111
|
+
zk-agent wallet reapprove --name main --relay-url <relay-url> --wait-relay --prompt-code
|
|
112
|
+
zk-agent next
|
|
113
|
+
```
|
|
172
114
|
|
|
173
|
-
|
|
115
|
+
If the relay is self-hosted through the built-in server:
|
|
174
116
|
|
|
175
|
-
|
|
176
|
-
|
|
117
|
+
```bash
|
|
118
|
+
zk-agent relay serve --public-origin https://relay.example.com
|
|
119
|
+
```
|
|
177
120
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
- `zk-agent deposit --wallet main --symbol USDC --amount <amount>`
|
|
182
|
-
- `zk-agent withdraw --wallet main --symbol USDC --amount <amount>`
|
|
121
|
+
Use `relay inspect` before sending users to a share link. It exposes hosted
|
|
122
|
+
readiness, URL shape, persistence mode, and the exact create/reapprove follow-up
|
|
123
|
+
path.
|
|
183
124
|
|
|
184
|
-
|
|
125
|
+
For the supported hosted operating contract, use
|
|
126
|
+
[`docs/16-hosted-approval-operated-baseline.md`](../../docs/16-hosted-approval-operated-baseline.md).
|
|
185
127
|
|
|
186
|
-
|
|
187
|
-
resolution when the local registry can resolve the active chain token
|
|
188
|
-
- `swap` follows the current registry-backed validated route by default when
|
|
189
|
-
`--protocol` is omitted
|
|
190
|
-
- `bridge` can reuse the tracked default destination route when one is already
|
|
191
|
-
known for the current wallet chain
|
|
128
|
+
## Funding and execution
|
|
192
129
|
|
|
193
|
-
|
|
130
|
+
Only fund when the CLI tells you funding is required:
|
|
194
131
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
132
|
+
```bash
|
|
133
|
+
zk-agent workflow fund --wallet main
|
|
134
|
+
zk-agent workflow fund --wallet main --amount <amount> --execute
|
|
135
|
+
```
|
|
198
136
|
|
|
199
|
-
|
|
137
|
+
Flagship pay path:
|
|
200
138
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
139
|
+
```bash
|
|
140
|
+
zk-agent workflow pay --wallet main --to <address> --amount <amount>
|
|
141
|
+
zk-agent workflow pay --wallet main --to <address> --amount <amount> --broadcast
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Keep `sed-lite` as the default AA baseline. Use `daily-spend-limit` only when
|
|
145
|
+
you intentionally need that narrower policy profile.
|
|
204
146
|
|
|
205
|
-
##
|
|
147
|
+
## Operator suite
|
|
206
148
|
|
|
207
|
-
|
|
149
|
+
Use:
|
|
208
150
|
|
|
209
151
|
```bash
|
|
210
|
-
zk-agent
|
|
211
|
-
zk-agent wallet create --relay-url <relay-url> --wait-relay --prompt-code
|
|
152
|
+
zk-agent suite
|
|
212
153
|
```
|
|
213
154
|
|
|
214
|
-
|
|
155
|
+
when you want the flagship path plus the current post-flagship surfaces in one
|
|
156
|
+
place.
|
|
215
157
|
|
|
216
|
-
|
|
217
|
-
zk-agent wallet reapprove --name main --relay-url <relay-url> --wait-relay --prompt-code
|
|
218
|
-
```
|
|
158
|
+
Current suite shape:
|
|
219
159
|
|
|
220
|
-
|
|
221
|
-
|
|
160
|
+
- flagship pay:
|
|
161
|
+
`zk-agent workflow pay --wallet main --to <address> --amount <amount>`
|
|
162
|
+
- discovery/defaults:
|
|
163
|
+
`zk-agent assets --wallet main`
|
|
164
|
+
`zk-agent defaults`
|
|
165
|
+
`zk-agent resolve-token --chain zksync-sepolia --symbol USDC`
|
|
166
|
+
- funding readiness:
|
|
167
|
+
`zk-agent workflow fund --wallet main`
|
|
168
|
+
- paymaster readiness:
|
|
169
|
+
`zk-agent workflow pay --wallet main --to <address> --amount <amount> --paymaster-mode approval-based`
|
|
170
|
+
`zk-agent tokens --chain zksync-sepolia --role paymaster-fee-token`
|
|
222
171
|
|
|
223
|
-
|
|
224
|
-
repair that locally instead of forcing a new approval round-trip:
|
|
172
|
+
## Discovery and direct commands
|
|
225
173
|
|
|
226
|
-
|
|
227
|
-
zk-agent wallet signer attach --name main --private-key <hex>
|
|
228
|
-
zk-agent next
|
|
229
|
-
```
|
|
174
|
+
Preferred discovery order:
|
|
230
175
|
|
|
231
|
-
|
|
176
|
+
- `zk-agent assets --wallet main`
|
|
177
|
+
- `zk-agent tokens --wallet main --owned`
|
|
178
|
+
- `zk-agent defaults`
|
|
179
|
+
- `zk-agent resolve-token --chain zksync-sepolia --symbol <symbol>`
|
|
232
180
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
zk-agent wallet create --relay-url <relay-url>
|
|
236
|
-
zk-agent wallet request approve --request-id <id> --relay-url <relay-url> --code <code> --wait
|
|
237
|
-
```
|
|
181
|
+
Use the direct commands when you intentionally want to bypass the workflow
|
|
182
|
+
layer:
|
|
238
183
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
`relay serve`, so hosted share-link approval no longer depends on a separate
|
|
245
|
-
source checkout just to serve the UI. `relay inspect` now also reports
|
|
246
|
-
`stateBackend`, `deploymentScope`, and `sameHostRestartPersists` so the
|
|
247
|
-
single-host local-filesystem constraint is explicit before you rely on a hosted
|
|
248
|
-
URL. For the current supported hosted operating contract and the remaining
|
|
249
|
-
`beta -> rc` blocker on this path, see
|
|
250
|
-
[`docs/16-hosted-approval-operated-baseline.md`](../../docs/16-hosted-approval-operated-baseline.md).
|
|
184
|
+
- `zk-agent send-token --wallet main --symbol USDC --to <address> --amount <amount>`
|
|
185
|
+
- `zk-agent swap --wallet main --token-in-symbol USDC --token-out-symbol ETH --amount-in <amount>`
|
|
186
|
+
- `zk-agent fund --wallet main --symbol USDC --amount <amount>`
|
|
187
|
+
- `zk-agent deposit --wallet main --symbol USDC --amount <amount>`
|
|
188
|
+
- `zk-agent withdraw --wallet main --symbol USDC --amount <amount>`
|
|
251
189
|
|
|
252
|
-
## Local
|
|
190
|
+
## Local storage
|
|
253
191
|
|
|
254
|
-
By default the CLI stores
|
|
255
|
-
under:
|
|
192
|
+
By default the CLI stores local state under:
|
|
256
193
|
|
|
257
194
|
```text
|
|
258
195
|
~/.zk-agent/
|
|
259
196
|
```
|
|
260
197
|
|
|
261
|
-
Common files
|
|
198
|
+
Common files:
|
|
262
199
|
|
|
263
200
|
- `config.json`
|
|
264
201
|
- `wallets/*.json`
|
|
265
202
|
- `requests/*.json`
|
|
266
203
|
- `workflows/*.json`
|
|
267
204
|
|
|
268
|
-
## Smart-
|
|
205
|
+
## Smart-account profiles
|
|
206
|
+
|
|
207
|
+
The packaged CLI includes built-in profile artifacts for:
|
|
269
208
|
|
|
270
|
-
|
|
271
|
-
|
|
209
|
+
- `sed-lite`
|
|
210
|
+
- `daily-spend-limit`
|
|
211
|
+
|
|
212
|
+
Inspect them with:
|
|
272
213
|
|
|
273
214
|
```bash
|
|
274
215
|
zk-agent wallet smart-account profiles --json
|
|
275
216
|
```
|
|
276
217
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
- `zk-agent wallet smart-account predict --profile sed-lite`
|
|
280
|
-
- `zk-agent wallet smart-account deploy --profile sed-lite`
|
|
281
|
-
- the same built-in path for `daily-spend-limit`
|
|
218
|
+
Use the packaged path for:
|
|
282
219
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
-
|
|
286
|
-
|
|
287
|
-
- `ZK_AGENT_ACCOUNT_PROFILES_ROOT` is now only a source-checkout override for
|
|
288
|
-
development or custom runtime layouts
|
|
220
|
+
```bash
|
|
221
|
+
zk-agent wallet smart-account predict --profile sed-lite
|
|
222
|
+
zk-agent wallet smart-account deploy --profile sed-lite
|
|
223
|
+
```
|
|
289
224
|
|
|
290
|
-
## Common
|
|
225
|
+
## Common failures
|
|
291
226
|
|
|
292
227
|
Connector callback never arrives:
|
|
293
228
|
|
|
294
229
|
- verify the connector URL saved by `zk-agent setup`
|
|
295
|
-
- if local callback is
|
|
296
|
-
|
|
230
|
+
- if local callback is impossible in the current environment, switch to the
|
|
231
|
+
relay-backed path
|
|
297
232
|
|
|
298
233
|
CLI says the wallet is missing a writable session:
|
|
299
234
|
|
|
300
|
-
-
|
|
235
|
+
- run `zk-agent doctor --wallet <wallet>`
|
|
301
236
|
- inspect `zk-agent wallet status --name <wallet>`
|
|
302
|
-
-
|
|
303
|
-
-
|
|
304
|
-
`zk-agent wallet signer attach --name <wallet> --private-key <hex>`
|
|
305
|
-
- then rerun `zk-agent next` or the blocked workflow command
|
|
237
|
+
- reapprove when approval is missing
|
|
238
|
+
- attach the signer when approval is present but local write readiness is not
|
|
306
239
|
|
|
307
240
|
Workflow stops on funding:
|
|
308
241
|
|
|
309
242
|
- do not guess the route
|
|
310
243
|
- run the exact `workflow fund` command suggested by the CLI
|
|
311
244
|
|
|
312
|
-
|
|
245
|
+
Locked-down environment blocks local callback or relay binding:
|
|
313
246
|
|
|
314
|
-
-
|
|
315
|
-
-
|
|
247
|
+
- rerun from a normal host shell
|
|
248
|
+
- or use a relay/manual approval path that matches the environment
|
|
316
249
|
|
|
317
|
-
## Command
|
|
250
|
+
## Command help
|
|
318
251
|
|
|
319
|
-
|
|
252
|
+
Use:
|
|
320
253
|
|
|
321
254
|
```bash
|
|
322
255
|
zk-agent --help
|
|
323
256
|
zk-agent doctor --help
|
|
324
257
|
zk-agent wallet --help
|
|
325
258
|
zk-agent workflow --help
|
|
259
|
+
zk-agent suite --help
|
|
326
260
|
```
|
|
327
261
|
|
|
328
262
|
## License
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command13, CommanderError } from "commander";
|
|
5
5
|
import { config as loadEnv } from "dotenv";
|
|
6
6
|
|
|
7
7
|
// src/commands/operations.ts
|
|
@@ -7824,8 +7824,8 @@ function buildTopLevelNextRecommendedCommand(requestId, paymasterMode) {
|
|
|
7824
7824
|
const command = requestId ? `zk-agent next --request-id ${requestId}` : "zk-agent next";
|
|
7825
7825
|
return appendPaymasterMode(command, paymasterMode);
|
|
7826
7826
|
}
|
|
7827
|
-
function buildWalletCreateRecommendedCommand() {
|
|
7828
|
-
return "zk-agent wallet create --await-local";
|
|
7827
|
+
function buildWalletCreateRecommendedCommand(paymasterMode) {
|
|
7828
|
+
return appendPaymasterMode("zk-agent wallet create --await-local", paymasterMode);
|
|
7829
7829
|
}
|
|
7830
7830
|
function buildRelayInspectRecommendedCommand(relayUrl = "<url>") {
|
|
7831
7831
|
return `zk-agent relay inspect --relay-url ${relayUrl}`;
|
|
@@ -7983,6 +7983,12 @@ function buildWorkflowPayRecommendedCommand(walletName, paymasterMode) {
|
|
|
7983
7983
|
const command = `zk-agent workflow pay --wallet ${walletName} --to <address> --amount <amount>`;
|
|
7984
7984
|
return appendPaymasterMode(command, paymasterMode);
|
|
7985
7985
|
}
|
|
7986
|
+
function buildWorkflowFundRecommendedCommand(walletName) {
|
|
7987
|
+
return `zk-agent workflow fund --wallet ${walletName}`;
|
|
7988
|
+
}
|
|
7989
|
+
function buildWorkflowFundRunRecommendedCommand(walletName) {
|
|
7990
|
+
return `zk-agent workflow fund --wallet ${walletName} --amount <amount> --execute`;
|
|
7991
|
+
}
|
|
7986
7992
|
function buildWorkflowShowRecommendedCommand(requestId) {
|
|
7987
7993
|
return `zk-agent workflow show --request-id ${requestId}`;
|
|
7988
7994
|
}
|
|
@@ -10145,6 +10151,66 @@ function onboardingSummaryLines(summary) {
|
|
|
10145
10151
|
];
|
|
10146
10152
|
}
|
|
10147
10153
|
|
|
10154
|
+
// src/lib/onboarding-paths.ts
|
|
10155
|
+
function formatRecommendedPath(commands) {
|
|
10156
|
+
return commands.join(" -> ");
|
|
10157
|
+
}
|
|
10158
|
+
function recommendedPathLines(paths) {
|
|
10159
|
+
if (!paths) return [];
|
|
10160
|
+
return [
|
|
10161
|
+
["path (local)", formatRecommendedPath(paths.local)],
|
|
10162
|
+
...paths.remoteBrowser?.length ? [["path (remote-browser)", formatRecommendedPath(paths.remoteBrowser)]] : []
|
|
10163
|
+
];
|
|
10164
|
+
}
|
|
10165
|
+
function buildSetupRecommendedPaths(relayUrl = "<url>", paymasterMode) {
|
|
10166
|
+
const next = buildTopLevelNextRecommendedCommand(void 0, paymasterMode);
|
|
10167
|
+
return {
|
|
10168
|
+
local: [
|
|
10169
|
+
"zk-agent setup",
|
|
10170
|
+
next,
|
|
10171
|
+
buildWalletCreateRecommendedCommand(paymasterMode),
|
|
10172
|
+
next
|
|
10173
|
+
],
|
|
10174
|
+
remoteBrowser: [
|
|
10175
|
+
"zk-agent setup",
|
|
10176
|
+
next,
|
|
10177
|
+
buildRelayInspectRecommendedCommand(relayUrl),
|
|
10178
|
+
buildWalletCreateRemoteRecommendedCommand(relayUrl, paymasterMode),
|
|
10179
|
+
next
|
|
10180
|
+
]
|
|
10181
|
+
};
|
|
10182
|
+
}
|
|
10183
|
+
function buildWalletBootstrapRecommendedPaths(relayUrl = "<url>", paymasterMode, walletName = "main") {
|
|
10184
|
+
const next = buildTopLevelNextRecommendedCommand(void 0, paymasterMode);
|
|
10185
|
+
return {
|
|
10186
|
+
local: [buildWalletCreateRecommendedCommand(paymasterMode), next],
|
|
10187
|
+
remoteBrowser: [
|
|
10188
|
+
buildRelayInspectRecommendedCommand(relayUrl),
|
|
10189
|
+
buildWalletCreateRemoteRecommendedCommand(relayUrl, paymasterMode, walletName),
|
|
10190
|
+
next
|
|
10191
|
+
]
|
|
10192
|
+
};
|
|
10193
|
+
}
|
|
10194
|
+
function buildWalletReapprovalRecommendedPaths(walletName, relayUrl = "<url>", paymasterMode) {
|
|
10195
|
+
const next = buildTopLevelNextRecommendedCommand(void 0, paymasterMode);
|
|
10196
|
+
return {
|
|
10197
|
+
local: [buildWalletReapproveRecommendedCommand(walletName), next],
|
|
10198
|
+
remoteBrowser: [
|
|
10199
|
+
buildRelayInspectRecommendedCommand(relayUrl),
|
|
10200
|
+
buildWalletReapproveRemoteRecommendedCommand(walletName, relayUrl),
|
|
10201
|
+
next
|
|
10202
|
+
]
|
|
10203
|
+
};
|
|
10204
|
+
}
|
|
10205
|
+
function buildSignerRecoveryRecommendedPaths(walletName, paymasterMode) {
|
|
10206
|
+
return {
|
|
10207
|
+
local: [
|
|
10208
|
+
buildWalletSignerAttachRecommendedCommand(walletName),
|
|
10209
|
+
buildTopLevelNextRecommendedCommand(void 0, paymasterMode)
|
|
10210
|
+
]
|
|
10211
|
+
};
|
|
10212
|
+
}
|
|
10213
|
+
|
|
10148
10214
|
// src/commands/setup.ts
|
|
10149
10215
|
function buildSetupHelpText() {
|
|
10150
10216
|
return [
|
|
@@ -10162,7 +10228,7 @@ function buildSetupHelpText() {
|
|
|
10162
10228
|
" zk-agent wallet create --await-local",
|
|
10163
10229
|
" zk-agent next",
|
|
10164
10230
|
"",
|
|
10165
|
-
"
|
|
10231
|
+
"Remote-browser variant of the same path:",
|
|
10166
10232
|
" zk-agent relay inspect --relay-url <url>",
|
|
10167
10233
|
" zk-agent wallet create --relay-url <url> --wait-relay --prompt-code",
|
|
10168
10234
|
" zk-agent next",
|
|
@@ -10182,6 +10248,7 @@ function createInitCommand() {
|
|
|
10182
10248
|
createWalletRemote: buildWalletCreateRemoteRecommendedCommand(),
|
|
10183
10249
|
afterWalletApproval: buildTopLevelNextRecommendedCommand()
|
|
10184
10250
|
};
|
|
10251
|
+
const recommendedPaths = buildSetupRecommendedPaths();
|
|
10185
10252
|
const existing = await loadProjectConfig();
|
|
10186
10253
|
if (existing && !options.force) {
|
|
10187
10254
|
const onboardingSummary2 = buildOnboardingSummary({
|
|
@@ -10202,6 +10269,7 @@ function createInitCommand() {
|
|
|
10202
10269
|
...onboardingSummaryLines(onboardingSummary2),
|
|
10203
10270
|
["default chain", existing.defaultChain],
|
|
10204
10271
|
["connector", existing.connectorUrl],
|
|
10272
|
+
...recommendedPathLines(recommendedPaths),
|
|
10205
10273
|
["next", recommendedCommands.next],
|
|
10206
10274
|
["inspect defaults", recommendedCommands.inspectDefaults],
|
|
10207
10275
|
["create wallet (local)", recommendedCommands.createWallet],
|
|
@@ -10214,6 +10282,7 @@ function createInitCommand() {
|
|
|
10214
10282
|
message: "Config already exists. Re-run with --force to overwrite.",
|
|
10215
10283
|
config: existing,
|
|
10216
10284
|
onboardingSummary: onboardingSummary2,
|
|
10285
|
+
recommendedPaths,
|
|
10217
10286
|
recommendedCommands
|
|
10218
10287
|
}
|
|
10219
10288
|
);
|
|
@@ -10245,6 +10314,7 @@ function createInitCommand() {
|
|
|
10245
10314
|
...onboardingSummaryLines(onboardingSummary),
|
|
10246
10315
|
["default chain", config.defaultChain],
|
|
10247
10316
|
["connector", config.connectorUrl],
|
|
10317
|
+
...recommendedPathLines(recommendedPaths),
|
|
10248
10318
|
["next", recommendedCommands.next],
|
|
10249
10319
|
["inspect defaults", recommendedCommands.inspectDefaults],
|
|
10250
10320
|
["create wallet (local)", recommendedCommands.createWallet],
|
|
@@ -10252,7 +10322,7 @@ function createInitCommand() {
|
|
|
10252
10322
|
["create wallet (remote)", recommendedCommands.createWalletRemote],
|
|
10253
10323
|
["after approval", recommendedCommands.afterWalletApproval]
|
|
10254
10324
|
],
|
|
10255
|
-
{ ok: true, config, onboardingSummary, recommendedCommands }
|
|
10325
|
+
{ ok: true, config, onboardingSummary, recommendedPaths, recommendedCommands }
|
|
10256
10326
|
);
|
|
10257
10327
|
});
|
|
10258
10328
|
}
|
|
@@ -10774,7 +10844,7 @@ function buildNextHelpText() {
|
|
|
10774
10844
|
" zk-agent wallet create --await-local",
|
|
10775
10845
|
" zk-agent next",
|
|
10776
10846
|
"",
|
|
10777
|
-
"
|
|
10847
|
+
" Remote-browser variant of the same path:",
|
|
10778
10848
|
" zk-agent relay inspect --relay-url <url>",
|
|
10779
10849
|
" zk-agent wallet create --relay-url <url> --wait-relay --prompt-code",
|
|
10780
10850
|
" zk-agent next",
|
|
@@ -10788,10 +10858,12 @@ function buildNextHelpText() {
|
|
|
10788
10858
|
" zk-agent wallet next --name main",
|
|
10789
10859
|
"",
|
|
10790
10860
|
" Switch to the hosted remote-approval path only when the browser is not colocated:",
|
|
10791
|
-
" zk-agent
|
|
10861
|
+
" zk-agent relay inspect --relay-url <url>",
|
|
10862
|
+
" zk-agent wallet create|reapprove --relay-url <url> --wait-relay --prompt-code",
|
|
10792
10863
|
"",
|
|
10793
|
-
" Use
|
|
10864
|
+
" Use wallet-layer commands when you already know the blocker is wallet-specific:",
|
|
10794
10865
|
" zk-agent wallet next --name main",
|
|
10866
|
+
" zk-agent wallet status --name main",
|
|
10795
10867
|
"",
|
|
10796
10868
|
" Stay on the workflow layer only when you already have an explicit workflow or checkpoint:",
|
|
10797
10869
|
" zk-agent workflow next --request-id <id>"
|
|
@@ -10898,6 +10970,7 @@ function createNextCommand(deps) {
|
|
|
10898
10970
|
afterSetup: buildTopLevelNextRecommendedCommand2(),
|
|
10899
10971
|
inspectDefaults: buildDefaultsRecommendedCommand()
|
|
10900
10972
|
};
|
|
10973
|
+
const recommendedPaths2 = buildSetupRecommendedPaths("<url>", paymasterMode);
|
|
10901
10974
|
const onboardingSummary2 = buildOnboardingSummary({
|
|
10902
10975
|
stage: "setup",
|
|
10903
10976
|
localOnly: true,
|
|
@@ -10914,6 +10987,7 @@ function createNextCommand(deps) {
|
|
|
10914
10987
|
["status", "No local config found"],
|
|
10915
10988
|
...agentProfileLines(agentProfile),
|
|
10916
10989
|
...agentFollowupLines(defaultAgentFollowup),
|
|
10990
|
+
...recommendedPathLines(recommendedPaths2),
|
|
10917
10991
|
["next", recommendedCommands2.setup],
|
|
10918
10992
|
["after setup", recommendedCommands2.afterSetup],
|
|
10919
10993
|
["inspect defaults", recommendedCommands2.inspectDefaults]
|
|
@@ -10924,6 +10998,7 @@ function createNextCommand(deps) {
|
|
|
10924
10998
|
status: "action-required",
|
|
10925
10999
|
nextCommand: recommendedCommands2.setup,
|
|
10926
11000
|
onboardingSummary: onboardingSummary2,
|
|
11001
|
+
recommendedPaths: recommendedPaths2,
|
|
10927
11002
|
agentProfile,
|
|
10928
11003
|
agentFollowup: defaultAgentFollowup,
|
|
10929
11004
|
recommendedCommands: recommendedCommands2
|
|
@@ -10946,6 +11021,11 @@ function createNextCommand(deps) {
|
|
|
10946
11021
|
afterApproval: appendPaymasterMode2(buildTopLevelNextRecommendedCommand2(), paymasterMode),
|
|
10947
11022
|
inspectDefaults: buildDefaultsRecommendedCommand()
|
|
10948
11023
|
};
|
|
11024
|
+
const recommendedPaths2 = buildWalletBootstrapRecommendedPaths(
|
|
11025
|
+
"<url>",
|
|
11026
|
+
paymasterMode,
|
|
11027
|
+
walletName
|
|
11028
|
+
);
|
|
10949
11029
|
const onboardingSummary2 = buildOnboardingSummary({
|
|
10950
11030
|
stage: "wallet-bootstrap",
|
|
10951
11031
|
localOnly: true,
|
|
@@ -10966,6 +11046,7 @@ function createNextCommand(deps) {
|
|
|
10966
11046
|
["connector", config.connectorUrl],
|
|
10967
11047
|
...agentProfileLines(agentProfile),
|
|
10968
11048
|
...agentFollowupLines(defaultAgentFollowup),
|
|
11049
|
+
...recommendedPathLines(recommendedPaths2),
|
|
10969
11050
|
["next", recommendedCommands2.createWallet],
|
|
10970
11051
|
["relay inspect", recommendedCommands2.relayInspect],
|
|
10971
11052
|
["remote fallback", recommendedCommands2.createWalletRemote],
|
|
@@ -10979,6 +11060,7 @@ function createNextCommand(deps) {
|
|
|
10979
11060
|
config,
|
|
10980
11061
|
nextCommand: recommendedCommands2.createWallet,
|
|
10981
11062
|
onboardingSummary: onboardingSummary2,
|
|
11063
|
+
recommendedPaths: recommendedPaths2,
|
|
10982
11064
|
agentProfile,
|
|
10983
11065
|
agentFollowup: defaultAgentFollowup,
|
|
10984
11066
|
recommendedCommands: recommendedCommands2
|
|
@@ -11055,39 +11137,64 @@ function createNextCommand(deps) {
|
|
|
11055
11137
|
nextAction: nextCommand,
|
|
11056
11138
|
inspectDefaults: buildDefaultsRecommendedCommand()
|
|
11057
11139
|
};
|
|
11140
|
+
const recoveryRecommendedCommands = !inspection.approvalReady ? {
|
|
11141
|
+
reapprove: buildWalletReapproveRecommendedCommand(wallet.walletName),
|
|
11142
|
+
relayInspect: buildRelayInspectRecommendedCommand(),
|
|
11143
|
+
reapproveRemote: buildWalletReapproveRemoteRecommendedCommand(wallet.walletName),
|
|
11144
|
+
afterRecovery: appendPaymasterMode2(buildTopLevelNextRecommendedCommand2(), paymasterMode)
|
|
11145
|
+
} : !inspection.localExecutionKeyStored ? {
|
|
11146
|
+
attachSigner: buildWalletSignerAttachRecommendedCommand(wallet.walletName),
|
|
11147
|
+
afterRecovery: appendPaymasterMode2(
|
|
11148
|
+
buildTopLevelNextRecommendedCommand2(),
|
|
11149
|
+
paymasterMode
|
|
11150
|
+
)
|
|
11151
|
+
} : {};
|
|
11152
|
+
const recommendedPaths = !inspection.approvalReady ? buildWalletReapprovalRecommendedPaths(wallet.walletName, "<url>", paymasterMode) : !inspection.localExecutionKeyStored ? buildSignerRecoveryRecommendedPaths(wallet.walletName, paymasterMode) : {
|
|
11153
|
+
local: [nextCommand]
|
|
11154
|
+
};
|
|
11155
|
+
const mergedRecommendedCommands = {
|
|
11156
|
+
...recommendedCommands,
|
|
11157
|
+
...recoveryRecommendedCommands
|
|
11158
|
+
};
|
|
11058
11159
|
const tokenDiscoverySummary = buildWalletTokenDiscoverySummary({
|
|
11059
11160
|
walletName: wallet.walletName,
|
|
11060
11161
|
chain: wallet.chain,
|
|
11061
11162
|
nextAction: nextCommand,
|
|
11062
11163
|
paymasterMode,
|
|
11063
|
-
recommendedCommands
|
|
11164
|
+
recommendedCommands: mergedRecommendedCommands
|
|
11064
11165
|
});
|
|
11065
11166
|
printResult(
|
|
11066
11167
|
topLevelNextLines("wallet", [
|
|
11067
11168
|
...walletNextLines(summary),
|
|
11068
11169
|
...agentProfileLines(agentProfile),
|
|
11069
11170
|
...agentFollowupLines(agentFollowup),
|
|
11171
|
+
...recommendedPathLines(recommendedPaths),
|
|
11070
11172
|
...summary.recommendedCommand ? [] : [["next", workflowPay]],
|
|
11071
|
-
["
|
|
11072
|
-
["
|
|
11073
|
-
...
|
|
11074
|
-
["
|
|
11075
|
-
|
|
11076
|
-
["
|
|
11077
|
-
["
|
|
11173
|
+
...mergedRecommendedCommands.reapprove ? [["reapprove", mergedRecommendedCommands.reapprove]] : [],
|
|
11174
|
+
...mergedRecommendedCommands.attachSigner ? [["attach signer", mergedRecommendedCommands.attachSigner]] : [],
|
|
11175
|
+
...mergedRecommendedCommands.relayInspect ? [["relay inspect", mergedRecommendedCommands.relayInspect]] : [],
|
|
11176
|
+
...mergedRecommendedCommands.reapproveRemote ? [["remote fallback", mergedRecommendedCommands.reapproveRemote]] : [],
|
|
11177
|
+
["discover assets", mergedRecommendedCommands.discoverAssets],
|
|
11178
|
+
["discover owned tokens", mergedRecommendedCommands.discoverOwnedTokens],
|
|
11179
|
+
...mergedRecommendedCommands.discoverPaymasterTokens ? [["discover paymaster tokens", mergedRecommendedCommands.discoverPaymasterTokens]] : [],
|
|
11180
|
+
["discover tokens", mergedRecommendedCommands.discoverTokens],
|
|
11181
|
+
...mergedRecommendedCommands.inspectPaymasterToken ? [["inspect paymaster token", mergedRecommendedCommands.inspectPaymasterToken]] : [],
|
|
11182
|
+
["inspect token", mergedRecommendedCommands.inspectToken],
|
|
11183
|
+
["inspect defaults", mergedRecommendedCommands.inspectDefaults]
|
|
11078
11184
|
], onboardingSummary),
|
|
11079
11185
|
{
|
|
11080
11186
|
ok: true,
|
|
11081
11187
|
scope: "wallet",
|
|
11082
11188
|
walletName: wallet.walletName,
|
|
11083
11189
|
onboardingSummary,
|
|
11190
|
+
recommendedPaths,
|
|
11084
11191
|
agentProfile,
|
|
11085
11192
|
agentFollowup,
|
|
11086
11193
|
inspection,
|
|
11087
11194
|
summary,
|
|
11088
11195
|
nextCommand,
|
|
11089
11196
|
tokenDiscoverySummary,
|
|
11090
|
-
recommendedCommands
|
|
11197
|
+
recommendedCommands: mergedRecommendedCommands
|
|
11091
11198
|
}
|
|
11092
11199
|
);
|
|
11093
11200
|
});
|
|
@@ -11114,7 +11221,7 @@ function buildDoctorHelpText() {
|
|
|
11114
11221
|
" and the shortest next command without requiring live RPC reads.",
|
|
11115
11222
|
" Run this before guessing whether the blocker is setup, wallet approval, or local signer state.",
|
|
11116
11223
|
"",
|
|
11117
|
-
"Remote-browser
|
|
11224
|
+
"Remote-browser variant:",
|
|
11118
11225
|
" Pass --relay-url when you want the remote approval fallback commands",
|
|
11119
11226
|
" to use a concrete relay URL instead of a placeholder."
|
|
11120
11227
|
].join("\n");
|
|
@@ -11204,6 +11311,7 @@ function buildDoctorResult(options) {
|
|
|
11204
11311
|
return {
|
|
11205
11312
|
scope: "setup",
|
|
11206
11313
|
nextAction: recommendedCommands2.setup,
|
|
11314
|
+
recommendedPaths: buildSetupRecommendedPaths(options.relayUrl),
|
|
11207
11315
|
onboardingSummary: onboardingSummary2,
|
|
11208
11316
|
summary: {
|
|
11209
11317
|
stage: "setup",
|
|
@@ -11244,6 +11352,7 @@ function buildDoctorResult(options) {
|
|
|
11244
11352
|
return {
|
|
11245
11353
|
scope: "wallet-bootstrap",
|
|
11246
11354
|
nextAction: recommendedCommands2.createWallet,
|
|
11355
|
+
recommendedPaths: buildWalletBootstrapRecommendedPaths(options.relayUrl, void 0, options.walletName),
|
|
11247
11356
|
onboardingSummary: onboardingSummary2,
|
|
11248
11357
|
summary: {
|
|
11249
11358
|
stage: "wallet-bootstrap",
|
|
@@ -11286,6 +11395,10 @@ function buildDoctorResult(options) {
|
|
|
11286
11395
|
return {
|
|
11287
11396
|
scope: "wallet-recovery",
|
|
11288
11397
|
nextAction: recommendedCommands2.reapprove,
|
|
11398
|
+
recommendedPaths: buildWalletReapprovalRecommendedPaths(
|
|
11399
|
+
options.wallet.walletName,
|
|
11400
|
+
options.relayUrl
|
|
11401
|
+
),
|
|
11289
11402
|
onboardingSummary: onboardingSummary2,
|
|
11290
11403
|
summary: {
|
|
11291
11404
|
stage: "wallet-recovery",
|
|
@@ -11329,6 +11442,7 @@ function buildDoctorResult(options) {
|
|
|
11329
11442
|
return {
|
|
11330
11443
|
scope: "wallet-recovery",
|
|
11331
11444
|
nextAction: attachSigner,
|
|
11445
|
+
recommendedPaths: buildSignerRecoveryRecommendedPaths(options.wallet.walletName),
|
|
11332
11446
|
onboardingSummary: onboardingSummary2,
|
|
11333
11447
|
summary: {
|
|
11334
11448
|
stage: "wallet-recovery",
|
|
@@ -11367,6 +11481,9 @@ function buildDoctorResult(options) {
|
|
|
11367
11481
|
return {
|
|
11368
11482
|
scope: "wallet-ready",
|
|
11369
11483
|
nextAction: recommendedCommands.next,
|
|
11484
|
+
recommendedPaths: {
|
|
11485
|
+
local: [recommendedCommands.next]
|
|
11486
|
+
},
|
|
11370
11487
|
onboardingSummary,
|
|
11371
11488
|
summary: {
|
|
11372
11489
|
stage: "wallet-ready",
|
|
@@ -11424,6 +11541,7 @@ function buildDoctorLines(input) {
|
|
|
11424
11541
|
}
|
|
11425
11542
|
}
|
|
11426
11543
|
lines.push(["next", input.nextAction]);
|
|
11544
|
+
lines.push(...recommendedPathLines(input.recommendedPaths));
|
|
11427
11545
|
if (input.recommendedCommands.createWallet) {
|
|
11428
11546
|
lines.push(["create wallet (local)", input.recommendedCommands.createWallet]);
|
|
11429
11547
|
}
|
|
@@ -11479,6 +11597,7 @@ function createDoctorCommand() {
|
|
|
11479
11597
|
wallet,
|
|
11480
11598
|
onboardingSummary: result.onboardingSummary,
|
|
11481
11599
|
summary: result.summary,
|
|
11600
|
+
recommendedPaths: result.recommendedPaths,
|
|
11482
11601
|
recommendedCommands: result.recommendedCommands,
|
|
11483
11602
|
nextAction: result.nextAction
|
|
11484
11603
|
}),
|
|
@@ -11503,6 +11622,7 @@ function createDoctorCommand() {
|
|
|
11503
11622
|
agentProfile,
|
|
11504
11623
|
agentFollowup,
|
|
11505
11624
|
nextAction: result.nextAction,
|
|
11625
|
+
recommendedPaths: result.recommendedPaths,
|
|
11506
11626
|
recommendedCommands: result.recommendedCommands
|
|
11507
11627
|
}
|
|
11508
11628
|
);
|
|
@@ -12586,8 +12706,135 @@ function normalizeSource(value) {
|
|
|
12586
12706
|
);
|
|
12587
12707
|
}
|
|
12588
12708
|
|
|
12589
|
-
// src/commands/
|
|
12709
|
+
// src/commands/suite.ts
|
|
12590
12710
|
import { Command as Command8 } from "commander";
|
|
12711
|
+
|
|
12712
|
+
// src/lib/operator-suite.ts
|
|
12713
|
+
function buildOperatorSuitePayload(options = {}) {
|
|
12714
|
+
const walletName = options.walletName?.trim() || "main";
|
|
12715
|
+
const chain = options.chain?.trim() || "zksync-sepolia";
|
|
12716
|
+
const flagshipCommand = buildWorkflowPayRecommendedCommand(walletName);
|
|
12717
|
+
const inspectDefaults = buildDefaultsRecommendedCommand();
|
|
12718
|
+
const discoveryCommand = buildAssetsRecommendedCommand(walletName);
|
|
12719
|
+
const paymasterCommand = buildWorkflowPayRecommendedCommand(walletName, "approval-based");
|
|
12720
|
+
const fundingCommand = buildWorkflowFundRecommendedCommand(walletName);
|
|
12721
|
+
const flagship = {
|
|
12722
|
+
id: "flagship-pay",
|
|
12723
|
+
title: "Flagship Pay",
|
|
12724
|
+
goal: "Run the default zkSync-native native-send path through the workflow layer.",
|
|
12725
|
+
primaryCommand: flagshipCommand,
|
|
12726
|
+
supportingCommands: [
|
|
12727
|
+
"zk-agent next",
|
|
12728
|
+
"zk-agent wallet status --name main",
|
|
12729
|
+
inspectDefaults
|
|
12730
|
+
],
|
|
12731
|
+
skillPath: "skills/zk-aa/SKILL.md"
|
|
12732
|
+
};
|
|
12733
|
+
const slices = [
|
|
12734
|
+
{
|
|
12735
|
+
id: "discovery-defaults",
|
|
12736
|
+
title: "Discovery / Defaults",
|
|
12737
|
+
goal: "Discover owned assets, tracked defaults, and symbol-first token resolution before acting.",
|
|
12738
|
+
primaryCommand: discoveryCommand,
|
|
12739
|
+
supportingCommands: [
|
|
12740
|
+
inspectDefaults,
|
|
12741
|
+
`zk-agent tokens --chain ${chain}`,
|
|
12742
|
+
buildResolveTokenRecommendedCommand(chain, "USDC")
|
|
12743
|
+
],
|
|
12744
|
+
skillPath: "skills/zk-discovery/SKILL.md",
|
|
12745
|
+
smokeCommand: `pnpm smoke:discovery -- --wallet ${walletName}`
|
|
12746
|
+
},
|
|
12747
|
+
{
|
|
12748
|
+
id: "paymaster-readiness",
|
|
12749
|
+
title: "Paymaster Readiness",
|
|
12750
|
+
goal: "Stay on the approval-based flagship path and recover the exact fee-token/default metadata when needed.",
|
|
12751
|
+
primaryCommand: paymasterCommand,
|
|
12752
|
+
supportingCommands: [
|
|
12753
|
+
inspectDefaults,
|
|
12754
|
+
buildPaymasterFeeTokensRecommendedCommand(chain),
|
|
12755
|
+
buildPaymasterFeeTokenResolveRecommendedCommand(chain)
|
|
12756
|
+
],
|
|
12757
|
+
skillPath: "skills/zk-paymaster/SKILL.md",
|
|
12758
|
+
smokeCommand: `pnpm smoke:paymaster-success -- --wallet ${walletName}`
|
|
12759
|
+
},
|
|
12760
|
+
{
|
|
12761
|
+
id: "funding-readiness",
|
|
12762
|
+
title: "Funding Readiness",
|
|
12763
|
+
goal: "Ask the workflow layer for the exact funding route before executing bridge/deposit follow-up.",
|
|
12764
|
+
primaryCommand: fundingCommand,
|
|
12765
|
+
supportingCommands: [
|
|
12766
|
+
buildWorkflowFundRunRecommendedCommand(walletName),
|
|
12767
|
+
`zk-agent fund --wallet ${walletName} --amount <amount>`,
|
|
12768
|
+
buildWorkflowStatusRecommendedCommand("<request-id>")
|
|
12769
|
+
],
|
|
12770
|
+
skillPath: "skills/zk-funding/SKILL.md",
|
|
12771
|
+
smokeCommand: `pnpm smoke:funding-readiness -- --wallet ${walletName}`
|
|
12772
|
+
}
|
|
12773
|
+
];
|
|
12774
|
+
return {
|
|
12775
|
+
ok: true,
|
|
12776
|
+
summary: {
|
|
12777
|
+
suiteId: "zk-agent-operator-suite",
|
|
12778
|
+
walletName,
|
|
12779
|
+
chain,
|
|
12780
|
+
flagshipId: flagship.id,
|
|
12781
|
+
postFlagshipSliceIds: slices.map((entry) => entry.id),
|
|
12782
|
+
nextAction: flagship.primaryCommand
|
|
12783
|
+
},
|
|
12784
|
+
flagship,
|
|
12785
|
+
slices,
|
|
12786
|
+
recommendedCommands: {
|
|
12787
|
+
suite: "zk-agent suite",
|
|
12788
|
+
flagship: flagshipCommand,
|
|
12789
|
+
discovery: discoveryCommand,
|
|
12790
|
+
paymaster: paymasterCommand,
|
|
12791
|
+
funding: fundingCommand,
|
|
12792
|
+
inspectDefaults
|
|
12793
|
+
}
|
|
12794
|
+
};
|
|
12795
|
+
}
|
|
12796
|
+
function operatorSuiteLines(payload) {
|
|
12797
|
+
const sliceLines = payload.slices.flatMap((entry) => [
|
|
12798
|
+
[entry.id, formatRecommendedPath([entry.primaryCommand, ...entry.supportingCommands])],
|
|
12799
|
+
[`${entry.id} skill`, entry.skillPath],
|
|
12800
|
+
...entry.smokeCommand ? [[`${entry.id} smoke`, entry.smokeCommand]] : []
|
|
12801
|
+
]);
|
|
12802
|
+
return [
|
|
12803
|
+
["suite", payload.summary.suiteId],
|
|
12804
|
+
["wallet", payload.summary.walletName],
|
|
12805
|
+
["chain", payload.summary.chain],
|
|
12806
|
+
["flagship", formatRecommendedPath([payload.flagship.primaryCommand, "zk-agent next"])],
|
|
12807
|
+
...sliceLines,
|
|
12808
|
+
["next action", payload.summary.nextAction]
|
|
12809
|
+
];
|
|
12810
|
+
}
|
|
12811
|
+
|
|
12812
|
+
// src/commands/suite.ts
|
|
12813
|
+
function createSuiteCommand() {
|
|
12814
|
+
return new Command8("suite").description("Show the flagship and post-flagship zkSync-native operator suite").option("--wallet <name>", "Wallet name used in example commands", "main").option("--chain <chain>", "Chain key used in example commands", "zksync-sepolia").addHelpText(
|
|
12815
|
+
"after",
|
|
12816
|
+
[
|
|
12817
|
+
"",
|
|
12818
|
+
" Current operator suite:",
|
|
12819
|
+
" zk-agent workflow pay --wallet main --to <address> --amount <amount>",
|
|
12820
|
+
" zk-agent assets --wallet main",
|
|
12821
|
+
" zk-agent workflow fund --wallet main",
|
|
12822
|
+
" zk-agent workflow pay --wallet main --to <address> --amount <amount> --paymaster-mode approval-based",
|
|
12823
|
+
"",
|
|
12824
|
+
" Use `suite` when you want the flagship path plus the current",
|
|
12825
|
+
" post-flagship discovery/defaults, funding, and paymaster surfaces in one place."
|
|
12826
|
+
].join("\n")
|
|
12827
|
+
).action((options) => {
|
|
12828
|
+
const payload = buildOperatorSuitePayload({
|
|
12829
|
+
walletName: options.wallet,
|
|
12830
|
+
chain: options.chain
|
|
12831
|
+
});
|
|
12832
|
+
printResult(operatorSuiteLines(payload), payload);
|
|
12833
|
+
});
|
|
12834
|
+
}
|
|
12835
|
+
|
|
12836
|
+
// src/commands/tokens.ts
|
|
12837
|
+
import { Command as Command9 } from "commander";
|
|
12591
12838
|
var provider2 = new ZkSyncWalletProvider();
|
|
12592
12839
|
function resolveTokensCommandDeps(deps) {
|
|
12593
12840
|
return {
|
|
@@ -12717,7 +12964,7 @@ function buildTokenDiscoverySummary(result) {
|
|
|
12717
12964
|
}
|
|
12718
12965
|
function createTokensCommand(deps) {
|
|
12719
12966
|
const resolvedDeps = resolveTokensCommandDeps(deps);
|
|
12720
|
-
return new
|
|
12967
|
+
return new Command9("tokens").description("List discoverable tokens from the configured local-first token registry, or inspect the owned ERC-20 registry subset for one wallet").addHelpText(
|
|
12721
12968
|
"after",
|
|
12722
12969
|
[
|
|
12723
12970
|
"",
|
|
@@ -12922,7 +13169,7 @@ function normalizeRole2(value) {
|
|
|
12922
13169
|
}
|
|
12923
13170
|
|
|
12924
13171
|
// src/commands/relay.ts
|
|
12925
|
-
import { Command as
|
|
13172
|
+
import { Command as Command10 } from "commander";
|
|
12926
13173
|
|
|
12927
13174
|
// src/lib/relay.ts
|
|
12928
13175
|
import { createServer } from "node:http";
|
|
@@ -13432,9 +13679,9 @@ async function startRelayServer(options) {
|
|
|
13432
13679
|
// src/commands/relay.ts
|
|
13433
13680
|
function buildRelayServeRecommendedCommands(options) {
|
|
13434
13681
|
const commands = {
|
|
13435
|
-
inspectRelay:
|
|
13436
|
-
createWallet:
|
|
13437
|
-
reapproveWallet:
|
|
13682
|
+
inspectRelay: buildRelayInspectRecommendedCommand(options.relayUrl),
|
|
13683
|
+
createWallet: buildWalletCreateRemoteRecommendedCommand(options.relayUrl),
|
|
13684
|
+
reapproveWallet: buildWalletReapproveRemoteRecommendedCommand("main", options.relayUrl)
|
|
13438
13685
|
};
|
|
13439
13686
|
if (options.publicOriginLooksLocal) {
|
|
13440
13687
|
return {
|
|
@@ -13447,14 +13694,41 @@ function buildRelayServeRecommendedCommands(options) {
|
|
|
13447
13694
|
function buildRelayInspectRecommendedCommands(options) {
|
|
13448
13695
|
const commands = {};
|
|
13449
13696
|
if (options.compatible) {
|
|
13450
|
-
commands.createWallet =
|
|
13451
|
-
commands.reapproveWallet =
|
|
13697
|
+
commands.createWallet = buildWalletCreateRemoteRecommendedCommand(options.publicOrigin);
|
|
13698
|
+
commands.reapproveWallet = buildWalletReapproveRemoteRecommendedCommand(
|
|
13699
|
+
"main",
|
|
13700
|
+
options.publicOrigin
|
|
13701
|
+
);
|
|
13452
13702
|
}
|
|
13453
13703
|
if (options.publicOriginLooksLocal) {
|
|
13454
13704
|
commands.restartWithPublicOrigin = "zk-agent relay serve --public-origin https://relay.example.com";
|
|
13455
13705
|
}
|
|
13456
13706
|
return commands;
|
|
13457
13707
|
}
|
|
13708
|
+
function buildRelayApprovalPaths(options) {
|
|
13709
|
+
const inspectRelay = buildRelayInspectRecommendedCommand(options.relayUrl);
|
|
13710
|
+
const next = buildTopLevelNextRecommendedCommand();
|
|
13711
|
+
const maybeInspectRelay = options.includeInspectRelay ? [inspectRelay] : [];
|
|
13712
|
+
return {
|
|
13713
|
+
createWallet: [
|
|
13714
|
+
...maybeInspectRelay,
|
|
13715
|
+
buildWalletCreateRemoteRecommendedCommand(options.relayUrl),
|
|
13716
|
+
next
|
|
13717
|
+
],
|
|
13718
|
+
reapproveWallet: [
|
|
13719
|
+
...maybeInspectRelay,
|
|
13720
|
+
buildWalletReapproveRemoteRecommendedCommand("main", options.relayUrl),
|
|
13721
|
+
next
|
|
13722
|
+
]
|
|
13723
|
+
};
|
|
13724
|
+
}
|
|
13725
|
+
function relayApprovalPathLines(paths) {
|
|
13726
|
+
if (!paths) return [];
|
|
13727
|
+
return [
|
|
13728
|
+
["path create wallet", formatRecommendedPath(paths.createWallet)],
|
|
13729
|
+
["path reapprove wallet", formatRecommendedPath(paths.reapproveWallet)]
|
|
13730
|
+
];
|
|
13731
|
+
}
|
|
13458
13732
|
function buildRelayHostedReadinessSummary(options) {
|
|
13459
13733
|
let status;
|
|
13460
13734
|
if (!options.compatible) {
|
|
@@ -13752,11 +14026,15 @@ function buildRelayInspectPayload(relayUrl, rawHealth) {
|
|
|
13752
14026
|
compatible,
|
|
13753
14027
|
publicOriginLooksLocal
|
|
13754
14028
|
}),
|
|
14029
|
+
relayApprovalPaths: compatible ? buildRelayApprovalPaths({
|
|
14030
|
+
relayUrl: publicOrigin,
|
|
14031
|
+
includeInspectRelay: false
|
|
14032
|
+
}) : void 0,
|
|
13755
14033
|
notes
|
|
13756
14034
|
};
|
|
13757
14035
|
}
|
|
13758
14036
|
function createRelayCommand() {
|
|
13759
|
-
const relay = new
|
|
14037
|
+
const relay = new Command10("relay").description("Run the local connector relay prototype server");
|
|
13760
14038
|
relay.addHelpText(
|
|
13761
14039
|
"after",
|
|
13762
14040
|
[
|
|
@@ -13798,6 +14076,10 @@ function createRelayCommand() {
|
|
|
13798
14076
|
relayUrl: publicOrigin,
|
|
13799
14077
|
publicOriginLooksLocal
|
|
13800
14078
|
});
|
|
14079
|
+
const relayApprovalPaths = buildRelayApprovalPaths({
|
|
14080
|
+
relayUrl: publicOrigin,
|
|
14081
|
+
includeInspectRelay: true
|
|
14082
|
+
});
|
|
13801
14083
|
const deploymentSummary = buildRelayDeploymentSummary({
|
|
13802
14084
|
origin: server.origin,
|
|
13803
14085
|
publicOrigin,
|
|
@@ -13862,6 +14144,7 @@ function createRelayCommand() {
|
|
|
13862
14144
|
...connectorUiAvailable ? ["connector-ui"] : []
|
|
13863
14145
|
],
|
|
13864
14146
|
recommendedCommands,
|
|
14147
|
+
relayApprovalPaths,
|
|
13865
14148
|
notes
|
|
13866
14149
|
};
|
|
13867
14150
|
if (shouldJsonOutput()) {
|
|
@@ -13891,6 +14174,9 @@ function createRelayCommand() {
|
|
|
13891
14174
|
humanLine("inspect relay", recommendedCommands.inspectRelay);
|
|
13892
14175
|
humanLine("create wallet", recommendedCommands.createWallet);
|
|
13893
14176
|
humanLine("reapprove wallet", recommendedCommands.reapproveWallet);
|
|
14177
|
+
for (const [label, value] of relayApprovalPathLines(relayApprovalPaths)) {
|
|
14178
|
+
humanLine(label, value);
|
|
14179
|
+
}
|
|
13894
14180
|
if (recommendedCommands.restartWithPublicOrigin) {
|
|
13895
14181
|
humanLine("restart with public origin", recommendedCommands.restartWithPublicOrigin);
|
|
13896
14182
|
}
|
|
@@ -13981,6 +14267,9 @@ function createRelayCommand() {
|
|
|
13981
14267
|
if (payload.recommendedCommands.reapproveWallet) {
|
|
13982
14268
|
humanLine("reapprove wallet", payload.recommendedCommands.reapproveWallet);
|
|
13983
14269
|
}
|
|
14270
|
+
for (const [label, value] of relayApprovalPathLines(payload.relayApprovalPaths)) {
|
|
14271
|
+
humanLine(label, value);
|
|
14272
|
+
}
|
|
13984
14273
|
}
|
|
13985
14274
|
if (payload.recommendedCommands.restartWithPublicOrigin) {
|
|
13986
14275
|
humanLine(
|
|
@@ -13998,7 +14287,7 @@ function createRelayCommand() {
|
|
|
13998
14287
|
// src/commands/wallet.ts
|
|
13999
14288
|
import { createServer as createServer2 } from "node:http";
|
|
14000
14289
|
import { createInterface } from "node:readline/promises";
|
|
14001
|
-
import { Command as
|
|
14290
|
+
import { Command as Command11 } from "commander";
|
|
14002
14291
|
|
|
14003
14292
|
// ../account-profiles/src/profiles.ts
|
|
14004
14293
|
import fs8 from "node:fs";
|
|
@@ -16665,32 +16954,32 @@ async function printBuiltinSmartAccountProfiles() {
|
|
|
16665
16954
|
}
|
|
16666
16955
|
function createWalletCommand(deps) {
|
|
16667
16956
|
const resolvedDeps = resolveWalletCommandDeps(deps);
|
|
16668
|
-
const wallet = new
|
|
16957
|
+
const wallet = new Command11("wallet").description(
|
|
16669
16958
|
"Create, inspect, and recover local-first wallet sessions"
|
|
16670
16959
|
);
|
|
16671
|
-
const request = new
|
|
16672
|
-
const signer = new
|
|
16960
|
+
const request = new Command11("request").description("Inspect and finalize pending wallet requests");
|
|
16961
|
+
const signer = new Command11("signer").description(
|
|
16673
16962
|
"Inspect and manage the stored local execution signer for a wallet"
|
|
16674
16963
|
);
|
|
16675
|
-
const smartAccount = new
|
|
16964
|
+
const smartAccount = new Command11("smart-account").description(
|
|
16676
16965
|
"Predict and deploy zkSync smart-account contracts from a supplied artifact or built-in profile"
|
|
16677
16966
|
);
|
|
16678
|
-
const sedLite = new
|
|
16967
|
+
const sedLite = new Command11("sed-lite").description(
|
|
16679
16968
|
"Inspect and manage the SED modular smart-account profile"
|
|
16680
16969
|
);
|
|
16681
|
-
const nativeCapHook = new
|
|
16970
|
+
const nativeCapHook = new Command11("native-cap-hook").description(
|
|
16682
16971
|
"Inspect and manage the first SED Lite validation-hook policy: native per-transaction spend caps"
|
|
16683
16972
|
);
|
|
16684
|
-
const targetAllowlistHook = new
|
|
16973
|
+
const targetAllowlistHook = new Command11("target-allowlist-hook").description(
|
|
16685
16974
|
"Inspect and manage the SED Lite validation-hook policy that restricts transactions to an allowlisted target set"
|
|
16686
16975
|
);
|
|
16687
|
-
const selectorAllowlistHook = new
|
|
16976
|
+
const selectorAllowlistHook = new Command11("selector-allowlist-hook").description(
|
|
16688
16977
|
"Inspect and manage the SED Lite validation-hook policy that restricts contract calls to allowlisted target and selector pairs"
|
|
16689
16978
|
);
|
|
16690
|
-
const dailySpendLimit = new
|
|
16979
|
+
const dailySpendLimit = new Command11("daily-spend-limit").description(
|
|
16691
16980
|
"Read and update the native-token daily spend limit used by the built-in daily-spend-limit smart-account profile"
|
|
16692
16981
|
);
|
|
16693
|
-
const paymaster = new
|
|
16982
|
+
const paymaster = new Command11("paymaster").description(
|
|
16694
16983
|
"Manage saved paymaster defaults for stored wallets"
|
|
16695
16984
|
);
|
|
16696
16985
|
wallet.addHelpText(
|
|
@@ -19319,7 +19608,7 @@ function createWalletCommand(deps) {
|
|
|
19319
19608
|
|
|
19320
19609
|
// src/commands/workflow.ts
|
|
19321
19610
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
19322
|
-
import { Command as
|
|
19611
|
+
import { Command as Command12 } from "commander";
|
|
19323
19612
|
var defaultProvider2 = new ZkSyncWalletProvider();
|
|
19324
19613
|
var defaultDefiProvider2 = new ZkSyncDefiProvider({
|
|
19325
19614
|
walletWriter: defaultProvider2
|
|
@@ -21059,7 +21348,7 @@ function applyWorkflowHelpCommandOrder(workflow) {
|
|
|
21059
21348
|
}
|
|
21060
21349
|
function createWorkflowCommand(deps) {
|
|
21061
21350
|
const resolvedDeps = resolveWorkflowCommandDeps(deps);
|
|
21062
|
-
const workflow = new
|
|
21351
|
+
const workflow = new Command12("workflow").description(
|
|
21063
21352
|
"Plan, persist, and execute higher-level wallet workflows"
|
|
21064
21353
|
);
|
|
21065
21354
|
workflow.addHelpText("after", buildWorkflowHelpText());
|
|
@@ -21713,6 +22002,9 @@ function buildDefaultOperatorPathHelpText() {
|
|
|
21713
22002
|
" zk-agent next",
|
|
21714
22003
|
` ${buildWorkflowPayRecommendedCommand("main")}`,
|
|
21715
22004
|
"",
|
|
22005
|
+
"Operator suite beyond flagship pay:",
|
|
22006
|
+
" zk-agent suite",
|
|
22007
|
+
"",
|
|
21716
22008
|
"Validated first-run baseline:",
|
|
21717
22009
|
" setup defaults to zksync-sepolia and the local connector at http://localhost:4444",
|
|
21718
22010
|
" Override those only when you intentionally target a different chain or connector deployment.",
|
|
@@ -21734,6 +22026,7 @@ var ROOT_HELP_COMMAND_ORDER = [
|
|
|
21734
22026
|
"init",
|
|
21735
22027
|
"wallet",
|
|
21736
22028
|
"workflow",
|
|
22029
|
+
"suite",
|
|
21737
22030
|
"assets",
|
|
21738
22031
|
"balances",
|
|
21739
22032
|
"fund",
|
|
@@ -21767,7 +22060,7 @@ function applyRootHelpCommandOrder(program) {
|
|
|
21767
22060
|
program.commands = sortedCommands;
|
|
21768
22061
|
}
|
|
21769
22062
|
function createProgram() {
|
|
21770
|
-
const program = new
|
|
22063
|
+
const program = new Command13().name("zk-agent").description(
|
|
21771
22064
|
"Local-first zkSync Era CLI for wallet approval, workflow execution, and hosted relay recovery"
|
|
21772
22065
|
).showHelpAfterError().option("--json", "Force JSON output for agent harnesses", false).hook("preAction", (thisCommand) => {
|
|
21773
22066
|
if (thisCommand.optsWithGlobals().json) process.env.ZK_AGENT_OUTPUT = "json";
|
|
@@ -21777,6 +22070,7 @@ function createProgram() {
|
|
|
21777
22070
|
program.addCommand(createDoctorCommand());
|
|
21778
22071
|
program.addCommand(createAgentCommand());
|
|
21779
22072
|
program.addCommand(createDefaultsCommand());
|
|
22073
|
+
program.addCommand(createSuiteCommand());
|
|
21780
22074
|
program.addCommand(createTokensCommand());
|
|
21781
22075
|
program.addCommand(createResolveTokenCommand());
|
|
21782
22076
|
program.addCommand(createRelayCommand());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zk-agent-cli",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.1",
|
|
4
4
|
"description": "Local-first zkSync Era and ZK Stack agent CLI with wallet session recovery, workflow orchestration, relay-backed approval, and SED smart-account support.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|