@thirdfy/agent-cli 0.1.39 → 0.1.41
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/CHANGELOG.md +12 -0
- package/README.md +2 -1
- package/bin/thirdfy-agent.mjs +71 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to `@thirdfy/agent-cli` are documented here. The format is b
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.1.41] - 2026-05-19
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Hyperliquid provider hints and docs list `get_hyperliquid_funding_status` as step 0 before onboarding plan; clarify Bridge2 sender custody, `--estimated-amount-usd` on `deposit_hyperliquid_bridge`, and `MANUAL_BRIDGE2_DEPOSIT_REQUIRED` guidance. Pairs with thirdfy-api-v2 **v3.4.24**.
|
|
12
|
+
|
|
13
|
+
## [0.1.40] - 2026-05-17
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Email login and bootstrap commands now persist agent credentials from nested API response shapes such as `registration.registration.agentApiKey`, so owner-session onboarding can resolve the hidden execution identity without requiring users to pass a raw agent API key manually.
|
|
18
|
+
|
|
7
19
|
## [0.1.39] - 2026-05-17
|
|
8
20
|
|
|
9
21
|
### Added
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ npx @thirdfy/agent-cli --help
|
|
|
42
42
|
|
|
43
43
|
## Release notes
|
|
44
44
|
|
|
45
|
-
Version history and highlights: [CHANGELOG.md](./CHANGELOG.md). **v0.1.39** makes `agent_wallet` the fresh solo default, adds framework guidance for Hermes/OpenClaw/Claude Managed Agents, clarifies Gator/ERC-7710 delegation flows, and keeps BYOW/self plus hybrid/thirdfy mode switching explicit. **v0.1.38** is a **documentation and metadata patch**: it republishes to npm so the package homepage matches the updated `README.md` on `main`, and aligns root `package-lock.json` version fields with `package.json`. **v0.1.37** adds **email OTP** `thirdfy-agent login email` (send code, then complete with `--code --accept-terms`), **`help onboarding`**, **`doctor auth`**, **`wallet list`**, and **masked `whoami`** output so agents and operators get first-run guidance without dumping secrets. Earlier releases added provider discovery parity, portfolio analytics, managed-wallet swap normalization, and **self/build-tx** swap human-decimal `amountIn` parity when using `amountInHuman` + `tokenInDecimals`.
|
|
45
|
+
Version history and highlights: [CHANGELOG.md](./CHANGELOG.md). **v0.1.41** documents Hyperliquid `get_hyperliquid_funding_status` as setup step 0, Bridge2 sender custody, and `deposit_hyperliquid_bridge --estimated-amount-usd` (pairs with API **v3.4.24**). **v0.1.40** fixes email/bootstrap credential persistence when the API returns nested registration payloads, so owner-session onboarding can save the hidden execution identity without exposing a raw agent API key. **v0.1.39** makes `agent_wallet` the fresh solo default, adds framework guidance for Hermes/OpenClaw/Claude Managed Agents, clarifies Gator/ERC-7710 delegation flows, and keeps BYOW/self plus hybrid/thirdfy mode switching explicit. **v0.1.38** is a **documentation and metadata patch**: it republishes to npm so the package homepage matches the updated `README.md` on `main`, and aligns root `package-lock.json` version fields with `package.json`. **v0.1.37** adds **email OTP** `thirdfy-agent login email` (send code, then complete with `--code --accept-terms`), **`help onboarding`**, **`doctor auth`**, **`wallet list`**, and **masked `whoami`** output so agents and operators get first-run guidance without dumping secrets. Earlier releases added provider discovery parity, portfolio analytics, managed-wallet swap normalization, and **self/build-tx** swap human-decimal `amountIn` parity when using `amountInHuman` + `tokenInDecimals`.
|
|
46
46
|
|
|
47
47
|
**Maintainers — npm:** follow [docs/releasing.md](./docs/releasing.md). From a clone with gitignored `.env`, use `npm run publish:npm:local -- --dry-run` then `npm run publish:npm:local`. Or run `npm run release:npm` after exporting tokens in the shell. Never commit npm tokens — use [.env.example](./.env.example) as a template only.
|
|
48
48
|
|
|
@@ -170,6 +170,7 @@ Auth expectations by mode:
|
|
|
170
170
|
- `hybrid`: requires execution identity and governed mirror semantics (`--hybrid-wallet-mode self|agent_wallet`, default `self`).
|
|
171
171
|
- `thirdfy`: requires execution identity and delegated governance path.
|
|
172
172
|
- `agent_wallet`: requires execution identity and owner `userDid`, but does not require subscriber delegation when the owner identity matches the agent wallet/creator.
|
|
173
|
+
- Hyperliquid Bridge2 setup is the Arbitrum exception to the Base-focused `agent_wallet` rule: Bridge2 credits the transaction sender. Pass **`--estimated-amount-usd`** as a top-level flag (not inside `--params`). When USDC sits on your linked email-login wallet (`primaryEvmWallet`) instead of the managed execution wallet, Thirdfy API **v3.4.23+** signs from the funded owner wallet when possible; otherwise it returns **`MANUAL_BRIDGE2_DEPOSIT_REQUIRED`** with `fundedWallet` and `executionWalletAddress`.
|
|
173
174
|
- custody mode defaults are profile-aware:
|
|
174
175
|
- `managed` default for `thirdfy`
|
|
175
176
|
- `external` default for `self` and `hybrid`
|
package/bin/thirdfy-agent.mjs
CHANGED
|
@@ -113,6 +113,43 @@ function buildTopLevelOnboardingHint(payload) {
|
|
|
113
113
|
return null;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
function extractAgentApiKey(value) {
|
|
117
|
+
if (!value || typeof value !== 'object') return '';
|
|
118
|
+
const candidates = [
|
|
119
|
+
value.agentApiKey,
|
|
120
|
+
value.apiKey,
|
|
121
|
+
value.data?.agentApiKey,
|
|
122
|
+
value.data?.apiKey,
|
|
123
|
+
value.bootstrap?.agentApiKey,
|
|
124
|
+
value.bootstrap?.apiKey,
|
|
125
|
+
value.registration?.agentApiKey,
|
|
126
|
+
value.registration?.apiKey,
|
|
127
|
+
value.registration?.registration?.agentApiKey,
|
|
128
|
+
value.registration?.registration?.apiKey,
|
|
129
|
+
value.data?.registration?.agentApiKey,
|
|
130
|
+
value.data?.registration?.apiKey,
|
|
131
|
+
value.data?.registration?.registration?.agentApiKey,
|
|
132
|
+
value.data?.registration?.registration?.apiKey,
|
|
133
|
+
];
|
|
134
|
+
return String(candidates.find((candidate) => String(candidate || '').trim()) || '').trim();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function extractAgentKey(value) {
|
|
138
|
+
if (!value || typeof value !== 'object') return '';
|
|
139
|
+
const candidates = [
|
|
140
|
+
value.agentKey,
|
|
141
|
+
value.data?.agentKey,
|
|
142
|
+
value.bootstrap?.agentKey,
|
|
143
|
+
value.registration?.agentKey,
|
|
144
|
+
value.registration?.registration?.agentKey,
|
|
145
|
+
value.data?.registration?.agentKey,
|
|
146
|
+
value.data?.registration?.registration?.agentKey,
|
|
147
|
+
value.owner?.creatorWallet,
|
|
148
|
+
value.data?.owner?.creatorWallet,
|
|
149
|
+
];
|
|
150
|
+
return String(candidates.find((candidate) => String(candidate || '').trim()) || '').trim();
|
|
151
|
+
}
|
|
152
|
+
|
|
116
153
|
async function main() {
|
|
117
154
|
const profileState = resolveProfileState(globalFlags);
|
|
118
155
|
context.profile = profileState.profile;
|
|
@@ -446,6 +483,7 @@ function getTradingProviderHint(providerId) {
|
|
|
446
483
|
'get_hyperliquid_candles',
|
|
447
484
|
'get_hyperliquid_user_state',
|
|
448
485
|
'get_hyperliquid_open_orders',
|
|
486
|
+
'get_hyperliquid_funding_status',
|
|
449
487
|
'get_hyperliquid_onboarding_plan',
|
|
450
488
|
'get_hyperliquid_referral_status',
|
|
451
489
|
'get_hyperliquid_builder_fee_status',
|
|
@@ -456,6 +494,7 @@ function getTradingProviderHint(providerId) {
|
|
|
456
494
|
'get_hyperliquid_open_orders',
|
|
457
495
|
],
|
|
458
496
|
setupActions: [
|
|
497
|
+
'get_hyperliquid_funding_status',
|
|
459
498
|
'get_hyperliquid_setup_status',
|
|
460
499
|
'get_hyperliquid_onboarding_plan',
|
|
461
500
|
'prepare_hyperliquid_onboarding',
|
|
@@ -469,7 +508,12 @@ function getTradingProviderHint(providerId) {
|
|
|
469
508
|
'deposit_hyperliquid_staking',
|
|
470
509
|
'claim_hyperliquid_testnet_faucet',
|
|
471
510
|
],
|
|
472
|
-
statusActions: [
|
|
511
|
+
statusActions: [
|
|
512
|
+
'get_hyperliquid_funding_status',
|
|
513
|
+
'get_hyperliquid_setup_status',
|
|
514
|
+
'get_hyperliquid_builder_fee_status',
|
|
515
|
+
'get_hyperliquid_referral_status',
|
|
516
|
+
],
|
|
473
517
|
credentialType: 'hyperliquid_api_wallet',
|
|
474
518
|
credentialUx:
|
|
475
519
|
'Thirdfy manages Hyperliquid API-wallet setup for normal users. Delegated writes require encrypted privateKey-backed hyperliquid_api_wallet credentials; walletAddress-only records are rejected until Privy walletId-backed Hyperliquid signing ships.',
|
|
@@ -496,7 +540,7 @@ function getTradingProviderHint(providerId) {
|
|
|
496
540
|
laneCompatibility:
|
|
497
541
|
'Use self only for setup signatures or Arbitrum funding transactions. Perps orders should use thirdfy, hybrid, or agent_wallet.',
|
|
498
542
|
setupExample:
|
|
499
|
-
'actions --provider hyperliquid -> get_hyperliquid_onboarding_plan -> prepare_hyperliquid_onboarding -> get_bridge_quote/execute_bridge if source is Base -> deposit_hyperliquid_bridge on 42161 -> approve_hyperliquid_agent -> approve_hyperliquid_builder_fee if required -> get_hyperliquid_setup_status',
|
|
543
|
+
'actions --provider hyperliquid -> get_hyperliquid_funding_status -> get_hyperliquid_onboarding_plan -> prepare_hyperliquid_onboarding -> get_bridge_quote/execute_bridge if source is Base -> deposit_hyperliquid_bridge on 42161 -> approve_hyperliquid_agent -> approve_hyperliquid_builder_fee if required -> get_hyperliquid_setup_status',
|
|
500
544
|
example:
|
|
501
545
|
'thirdfy-agent actions --provider hyperliquid && thirdfy-agent preflight --action place_hyperliquid_perps_order --params \'{"coin":"ETH","isBuy":true,"size":0.01,"limitPx":3500,"orderType":"market"}\'',
|
|
502
546
|
};
|
|
@@ -1874,6 +1918,8 @@ async function commandDeveloperBootstrap(ctx, flags, capabilities) {
|
|
|
1874
1918
|
{ ...registerFlags, __suppressOutput: true },
|
|
1875
1919
|
capabilities
|
|
1876
1920
|
);
|
|
1921
|
+
const agentApiKey = extractAgentApiKey(registerResponse || {});
|
|
1922
|
+
const responseAgentKey = extractAgentKey(registerResponse || {}) || agentKey;
|
|
1877
1923
|
|
|
1878
1924
|
const config = loadProfileConfig();
|
|
1879
1925
|
const next = {
|
|
@@ -1890,6 +1936,13 @@ async function commandDeveloperBootstrap(ctx, flags, capabilities) {
|
|
|
1890
1936
|
bootstrapCompletedAt: new Date().toISOString(),
|
|
1891
1937
|
},
|
|
1892
1938
|
};
|
|
1939
|
+
if (agentApiKey || responseAgentKey) {
|
|
1940
|
+
next.agent = {
|
|
1941
|
+
...(config.agent && typeof config.agent === 'object' ? config.agent : {}),
|
|
1942
|
+
...(agentApiKey ? { apiKey: agentApiKey } : {}),
|
|
1943
|
+
...(responseAgentKey ? { agentKey: responseAgentKey } : {}),
|
|
1944
|
+
};
|
|
1945
|
+
}
|
|
1893
1946
|
persistProfileConfig(next);
|
|
1894
1947
|
if (!flags.__suppressOutput) {
|
|
1895
1948
|
printEnvelope({
|
|
@@ -2154,6 +2207,19 @@ async function commandBootstrapComplete(ctx, flags, capabilities) {
|
|
|
2154
2207
|
capabilities
|
|
2155
2208
|
);
|
|
2156
2209
|
}
|
|
2210
|
+
const registrationAgentApiKey = extractAgentApiKey(registration || {});
|
|
2211
|
+
const registrationAgentKey = extractAgentKey(registration || {}) || agentKey;
|
|
2212
|
+
if (registrationAgentApiKey || registrationAgentKey) {
|
|
2213
|
+
const latest = loadProfileConfig();
|
|
2214
|
+
persistProfileConfig({
|
|
2215
|
+
...latest,
|
|
2216
|
+
agent: {
|
|
2217
|
+
...(latest.agent && typeof latest.agent === 'object' ? latest.agent : {}),
|
|
2218
|
+
...(registrationAgentApiKey ? { apiKey: registrationAgentApiKey } : {}),
|
|
2219
|
+
...(registrationAgentKey ? { agentKey: registrationAgentKey } : {}),
|
|
2220
|
+
},
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2157
2223
|
|
|
2158
2224
|
printEnvelope({
|
|
2159
2225
|
success: true,
|
|
@@ -2901,8 +2967,8 @@ async function commandLoginEmail(ctx, flags) {
|
|
|
2901
2967
|
const data = response?.data || response || {};
|
|
2902
2968
|
const ownerSessionToken = String(data.ownerSessionToken || '').trim();
|
|
2903
2969
|
const bootstrap = data.bootstrap && typeof data.bootstrap === 'object' ? data.bootstrap : {};
|
|
2904
|
-
const agentApiKey =
|
|
2905
|
-
const agentKey =
|
|
2970
|
+
const agentApiKey = extractAgentApiKey(data);
|
|
2971
|
+
const agentKey = extractAgentKey(data);
|
|
2906
2972
|
const wallets = data.wallets && typeof data.wallets === 'object' ? data.wallets : {};
|
|
2907
2973
|
const userDid = String(data.owner?.creatorDid || wallets.userDid || '').trim();
|
|
2908
2974
|
const primaryEvmWallet = String(wallets.primaryEvmWallet || data.owner?.creatorWallet || '').trim();
|
|
@@ -3943,6 +4009,7 @@ function inferActionProvider(action) {
|
|
|
3943
4009
|
'get-hyperliquid-user-state': 'hyperliquid',
|
|
3944
4010
|
'get-hyperliquid-open-orders': 'hyperliquid',
|
|
3945
4011
|
'get-hyperliquid-setup-status': 'hyperliquid',
|
|
4012
|
+
'get-hyperliquid-funding-status': 'hyperliquid',
|
|
3946
4013
|
'get-hyperliquid-onboarding-plan': 'hyperliquid',
|
|
3947
4014
|
'prepare-hyperliquid-onboarding': 'hyperliquid',
|
|
3948
4015
|
'claim-hyperliquid-testnet-faucet': 'hyperliquid',
|