@thirdfy/agent-cli 0.1.5 → 0.1.7
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 +147 -12
- package/bin/thirdfy-agent.mjs +1021 -33
- package/package.json +10 -1
- package/src/utils/cli/intentNormalization.cjs +20 -1
package/README.md
CHANGED
|
@@ -16,6 +16,9 @@ If you want the full developer docs, start here:
|
|
|
16
16
|
- [API Reference home](https://docs.thirdfy.com/api)
|
|
17
17
|
- [LLM docs map (llms.txt)](https://docs.thirdfy.com/llms.txt)
|
|
18
18
|
- [LLM full API snapshot (llms-full.txt)](https://docs.thirdfy.com/llms-full.txt)
|
|
19
|
+
- [DogeOS quickstart (repo)](./docs/dogeos-quickstart.md)
|
|
20
|
+
- [Action onboarding standard](./docs/action-onboarding-standard.md)
|
|
21
|
+
- [Skill integration RFC](./docs/skill-integration-rfc.md)
|
|
19
22
|
|
|
20
23
|
## Install
|
|
21
24
|
|
|
@@ -33,38 +36,64 @@ npx @thirdfy/agent-cli --help
|
|
|
33
36
|
## Quick start
|
|
34
37
|
|
|
35
38
|
```bash
|
|
36
|
-
export THIRDFY_API_BASE="https://api.thirdfy.com"
|
|
37
39
|
export AGENT_API_KEY="..."
|
|
38
40
|
export THIRDFY_AUTH_TOKEN="..."
|
|
39
41
|
export THIRDFY_OWNER_SESSION_TOKEN="..."
|
|
40
42
|
|
|
41
|
-
thirdfy-agent actions --
|
|
43
|
+
thirdfy-agent actions --agent-api-key "$AGENT_API_KEY" --json
|
|
42
44
|
thirdfy-agent profile init --profile personal --json
|
|
43
|
-
thirdfy-agent preflight --
|
|
44
|
-
thirdfy-agent run --
|
|
45
|
-
thirdfy-agent intent-status --
|
|
45
|
+
thirdfy-agent preflight --agent-api-key "$AGENT_API_KEY" --action swap --params '{"tokenIn":"0x...","tokenOut":"0x...","amountInRaw":"1000000"}' --estimated-amount-usd 25 --json
|
|
46
|
+
thirdfy-agent run --agent-api-key "$AGENT_API_KEY" --action swap --params '{"tokenIn":"0x...","tokenOut":"0x...","amountInRaw":"1000000"}' --estimated-amount-usd 25 --json
|
|
47
|
+
thirdfy-agent intent-status --intent-id "<intentId>" --json
|
|
46
48
|
```
|
|
47
49
|
|
|
50
|
+
By default, the CLI targets production (`https://api.thirdfy.com`). Use `--api-base` (or `THIRDFY_API_BASE`) only for staging/dev/custom deployments.
|
|
51
|
+
|
|
48
52
|
## Auth model
|
|
49
53
|
|
|
50
|
-
- `AGENT_API_KEY`: execution identity
|
|
51
|
-
- `THIRDFY_AUTH_TOKEN`:
|
|
52
|
-
- `THIRDFY_OWNER_SESSION_TOKEN`: wallet-sign owner
|
|
54
|
+
- `AGENT_API_KEY`: execution identity for `preflight`, `run`, `self-exec`, and policy-aware discovery.
|
|
55
|
+
- `THIRDFY_AUTH_TOKEN`: owner/account auth for onboarding and delegation commands.
|
|
56
|
+
- `THIRDFY_OWNER_SESSION_TOKEN`: wallet-sign owner session for onboarding and owner operations.
|
|
57
|
+
|
|
58
|
+
CLI precedence now supports login/config defaults:
|
|
59
|
+
|
|
60
|
+
1. explicit flag
|
|
61
|
+
2. environment variable
|
|
62
|
+
3. `~/.thirdfy/config.json` (from `thirdfy-agent login` / `config set`)
|
|
53
63
|
|
|
54
64
|
Execution-only workflows can run with only `AGENT_API_KEY` after onboarding is complete.
|
|
55
65
|
|
|
66
|
+
### Login / logout / config UX
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Store auth defaults once
|
|
70
|
+
thirdfy-agent login --auth-token "$THIRDFY_AUTH_TOKEN" --agent-api-key "$AGENT_API_KEY" --json
|
|
71
|
+
|
|
72
|
+
# Inspect config
|
|
73
|
+
thirdfy-agent whoami --json
|
|
74
|
+
thirdfy-agent config set --key runMode --value self --json
|
|
75
|
+
|
|
76
|
+
# Local-only logout (default)
|
|
77
|
+
thirdfy-agent logout --json
|
|
78
|
+
|
|
79
|
+
# Local clear + server owner-session revoke (if present)
|
|
80
|
+
thirdfy-agent logout --all --json
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`logout --all` is provider-agnostic: it attempts owner-session revocation when a session token exists, then always clears local credentials.
|
|
84
|
+
|
|
56
85
|
### Wallet-sign onboarding path
|
|
57
86
|
|
|
58
87
|
```bash
|
|
59
|
-
thirdfy-agent agent auth challenge --
|
|
88
|
+
thirdfy-agent agent auth challenge --agent-key "0xYOUR_AGENT_KEY" --json
|
|
60
89
|
# Sign challenge.message with your wallet, then:
|
|
61
|
-
thirdfy-agent agent auth verify --
|
|
90
|
+
thirdfy-agent agent auth verify --challenge-id "<challengeId>" --signature "0x..." --agent-key "0xYOUR_AGENT_KEY" --json
|
|
62
91
|
```
|
|
63
92
|
|
|
64
93
|
Use the returned session token:
|
|
65
94
|
|
|
66
95
|
```bash
|
|
67
|
-
thirdfy-agent agent register --
|
|
96
|
+
thirdfy-agent agent register --owner-session-token "$THIRDFY_OWNER_SESSION_TOKEN" --agent-key "0xYOUR_AGENT_KEY" --name "my-agent" --json
|
|
68
97
|
```
|
|
69
98
|
|
|
70
99
|
### Idempotency behavior (`run`)
|
|
@@ -81,6 +110,12 @@ thirdfy-agent agent register --api-base "$THIRDFY_API_BASE" --owner-session-toke
|
|
|
81
110
|
- `--run-mode self` -> self-custody rail (`build-tx` flow; default for `profile=personal`)
|
|
82
111
|
- `--run-mode hybrid` -> self-custody + governance mirror metadata (default for `profile=builder`)
|
|
83
112
|
|
|
113
|
+
Auth expectations by mode:
|
|
114
|
+
|
|
115
|
+
- `self`: requires execution identity (`agentApiKey`) today; keyless self lane is blocked with deterministic `SELF_OPEN_DISABLED`.
|
|
116
|
+
- `hybrid`: requires execution identity and governed mirror semantics.
|
|
117
|
+
- `thirdfy`: requires execution identity and delegated governance path.
|
|
118
|
+
|
|
84
119
|
Selection precedence:
|
|
85
120
|
|
|
86
121
|
1. `--run-mode`
|
|
@@ -98,6 +133,28 @@ thirdfy-agent whoami --json
|
|
|
98
133
|
|
|
99
134
|
`profile use --profile <name>` resets run mode to that profile default unless `--run-mode` is explicitly provided.
|
|
100
135
|
|
|
136
|
+
## Swap amount contract (agent-safe)
|
|
137
|
+
|
|
138
|
+
For `--action swap`, CLI enforces an explicit amount unit contract:
|
|
139
|
+
|
|
140
|
+
- Provide exactly one of:
|
|
141
|
+
- `amountInRaw` (base units integer string), or
|
|
142
|
+
- `amountInHuman` + `tokenInDecimals` (CLI converts to `amountInRaw`)
|
|
143
|
+
- Legacy `amountIn` is accepted only as raw integer compatibility input.
|
|
144
|
+
- Ambiguous payloads (both/none) fail with `AMOUNT_UNIT_AMBIGUOUS`.
|
|
145
|
+
|
|
146
|
+
Examples:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Raw/base units
|
|
150
|
+
thirdfy-agent run --agent-api-key "$AGENT_API_KEY" --action swap \
|
|
151
|
+
--params '{"tokenIn":"0x...","tokenOut":"0x...","amountInRaw":"1000000","chainId":8453}' --json
|
|
152
|
+
|
|
153
|
+
# Human units + decimals
|
|
154
|
+
thirdfy-agent run --agent-api-key "$AGENT_API_KEY" --action swap \
|
|
155
|
+
--params '{"tokenIn":"0x...","tokenOut":"0x...","amountInHuman":"1.5","tokenInDecimals":6,"chainId":8453}' --json
|
|
156
|
+
```
|
|
157
|
+
|
|
101
158
|
## Jeff shorthand rail
|
|
102
159
|
|
|
103
160
|
Jeff-friendly aliases map directly to core commands:
|
|
@@ -113,9 +170,87 @@ Jeff-friendly aliases map directly to core commands:
|
|
|
113
170
|
- Execution: `preflight`, `run`, `intent-status`, `jeff preflight`, `jeff trade`, `jeff status`
|
|
114
171
|
- Profiles: `profile init`, `profile use`, `profile show`, `whoami`
|
|
115
172
|
- Onboarding: `agent auth challenge`, `agent auth verify`, `agent register`, `agent key rotate`, `agent key revoke`
|
|
116
|
-
- Governance readiness: `delegation
|
|
173
|
+
- Governance readiness: `delegation create`, `delegation activate`, `delegation status`, `credentials upsert`, `credentials status`
|
|
174
|
+
- Delegation operations: `delegation show`, `delegation inspect`, `delegation revoke`
|
|
175
|
+
- Delegation execution helpers: `delegation balance`, `delegation redeem`
|
|
117
176
|
- Account: `credits balance`
|
|
118
177
|
|
|
178
|
+
## Delegation lifecycle (canonical)
|
|
179
|
+
|
|
180
|
+
Use `create` + `activate` as the default delegated execution lifecycle:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
thirdfy-agent delegation create \
|
|
184
|
+
--auth-token "$THIRDFY_AUTH_TOKEN" \
|
|
185
|
+
--agent-key "0xYOUR_AGENT_KEY" \
|
|
186
|
+
--owner-address "0xOWNER_WALLET" \
|
|
187
|
+
--token-address "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" \
|
|
188
|
+
--max-usd-per-day 250 \
|
|
189
|
+
--json
|
|
190
|
+
|
|
191
|
+
# Sign the returned `data.delegation` payload in your wallet, then:
|
|
192
|
+
thirdfy-agent delegation activate \
|
|
193
|
+
--auth-token "$THIRDFY_AUTH_TOKEN" \
|
|
194
|
+
--agent-key "0xYOUR_AGENT_KEY" \
|
|
195
|
+
--wallet-address "0xOWNER_WALLET" \
|
|
196
|
+
--session-account-address "0xSESSION_ACCOUNT" \
|
|
197
|
+
--delegation-manager "0xDELEGATION_MANAGER" \
|
|
198
|
+
--delegation '{"delegator":"0x...","delegate":"0x...","authority":"0x...","caveats":[],"salt":"0x...","signature":"0x"}' \
|
|
199
|
+
--signature "0xSIGNED_DELEGATION" \
|
|
200
|
+
--json
|
|
201
|
+
|
|
202
|
+
thirdfy-agent delegation status \
|
|
203
|
+
--auth-token "$THIRDFY_AUTH_TOKEN" \
|
|
204
|
+
--agent-key "0xYOUR_AGENT_KEY" \
|
|
205
|
+
--verify \
|
|
206
|
+
--json
|
|
207
|
+
|
|
208
|
+
thirdfy-agent delegation inspect \
|
|
209
|
+
--auth-token "$THIRDFY_AUTH_TOKEN" \
|
|
210
|
+
--agent-key "0xYOUR_AGENT_KEY" \
|
|
211
|
+
--verify \
|
|
212
|
+
--json
|
|
213
|
+
|
|
214
|
+
thirdfy-agent delegation revoke \
|
|
215
|
+
--auth-token "$THIRDFY_AUTH_TOKEN" \
|
|
216
|
+
--agent-key "0xYOUR_AGENT_KEY" \
|
|
217
|
+
--reason "user_revoked" \
|
|
218
|
+
--json
|
|
219
|
+
|
|
220
|
+
thirdfy-agent delegation balance \
|
|
221
|
+
--auth-token "$THIRDFY_AUTH_TOKEN" \
|
|
222
|
+
--agent-key "0xYOUR_AGENT_KEY" \
|
|
223
|
+
--json
|
|
224
|
+
|
|
225
|
+
thirdfy-agent delegation redeem \
|
|
226
|
+
--run-mode thirdfy \
|
|
227
|
+
--agent-api-key "$AGENT_API_KEY" \
|
|
228
|
+
--action swap \
|
|
229
|
+
--params '{"tokenIn":"0x...","tokenOut":"0x...","amountInRaw":"1000000"}' \
|
|
230
|
+
--estimated-amount-usd 5 \
|
|
231
|
+
--json
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### MetaMask custodial-compatible lifecycle (new)
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
thirdfy-agent delegation init-custodial \
|
|
238
|
+
--auth-token "$THIRDFY_AUTH_TOKEN" \
|
|
239
|
+
--chain-id 8453 \
|
|
240
|
+
--json
|
|
241
|
+
|
|
242
|
+
thirdfy-agent delegation custodial-grant \
|
|
243
|
+
--auth-token "$THIRDFY_AUTH_TOKEN" \
|
|
244
|
+
--agent-key "0xYOUR_AGENT_KEY" \
|
|
245
|
+
--token-address "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" \
|
|
246
|
+
--max-usd-per-day 250 \
|
|
247
|
+
--json
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
The CLI keeps compatibility with legacy `delegation create` + `delegation activate` during migration.
|
|
251
|
+
|
|
252
|
+
`delegation show` is a direct alias to `delegation status` for gator-style operator ergonomics.
|
|
253
|
+
|
|
119
254
|
## More docs
|
|
120
255
|
|
|
121
256
|
- OpenClaw CLI onboarding flow:
|