@thirdfy/agent-cli 0.1.39 → 0.1.40

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 CHANGED
@@ -4,6 +4,12 @@ All notable changes to `@thirdfy/agent-cli` are documented here. The format is b
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.1.40] - 2026-05-17
8
+
9
+ ### Fixed
10
+
11
+ - 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.
12
+
7
13
  ## [0.1.39] - 2026-05-17
8
14
 
9
15
  ### 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.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
 
@@ -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;
@@ -1874,6 +1911,8 @@ async function commandDeveloperBootstrap(ctx, flags, capabilities) {
1874
1911
  { ...registerFlags, __suppressOutput: true },
1875
1912
  capabilities
1876
1913
  );
1914
+ const agentApiKey = extractAgentApiKey(registerResponse || {});
1915
+ const responseAgentKey = extractAgentKey(registerResponse || {}) || agentKey;
1877
1916
 
1878
1917
  const config = loadProfileConfig();
1879
1918
  const next = {
@@ -1890,6 +1929,13 @@ async function commandDeveloperBootstrap(ctx, flags, capabilities) {
1890
1929
  bootstrapCompletedAt: new Date().toISOString(),
1891
1930
  },
1892
1931
  };
1932
+ if (agentApiKey || responseAgentKey) {
1933
+ next.agent = {
1934
+ ...(config.agent && typeof config.agent === 'object' ? config.agent : {}),
1935
+ ...(agentApiKey ? { apiKey: agentApiKey } : {}),
1936
+ ...(responseAgentKey ? { agentKey: responseAgentKey } : {}),
1937
+ };
1938
+ }
1893
1939
  persistProfileConfig(next);
1894
1940
  if (!flags.__suppressOutput) {
1895
1941
  printEnvelope({
@@ -2154,6 +2200,19 @@ async function commandBootstrapComplete(ctx, flags, capabilities) {
2154
2200
  capabilities
2155
2201
  );
2156
2202
  }
2203
+ const registrationAgentApiKey = extractAgentApiKey(registration || {});
2204
+ const registrationAgentKey = extractAgentKey(registration || {}) || agentKey;
2205
+ if (registrationAgentApiKey || registrationAgentKey) {
2206
+ const latest = loadProfileConfig();
2207
+ persistProfileConfig({
2208
+ ...latest,
2209
+ agent: {
2210
+ ...(latest.agent && typeof latest.agent === 'object' ? latest.agent : {}),
2211
+ ...(registrationAgentApiKey ? { apiKey: registrationAgentApiKey } : {}),
2212
+ ...(registrationAgentKey ? { agentKey: registrationAgentKey } : {}),
2213
+ },
2214
+ });
2215
+ }
2157
2216
 
2158
2217
  printEnvelope({
2159
2218
  success: true,
@@ -2901,8 +2960,8 @@ async function commandLoginEmail(ctx, flags) {
2901
2960
  const data = response?.data || response || {};
2902
2961
  const ownerSessionToken = String(data.ownerSessionToken || '').trim();
2903
2962
  const bootstrap = data.bootstrap && typeof data.bootstrap === 'object' ? data.bootstrap : {};
2904
- const agentApiKey = String(bootstrap.agentApiKey || '').trim();
2905
- const agentKey = String(bootstrap.agentKey || data.owner?.creatorWallet || '').trim();
2963
+ const agentApiKey = extractAgentApiKey(data);
2964
+ const agentKey = extractAgentKey(data);
2906
2965
  const wallets = data.wallets && typeof data.wallets === 'object' ? data.wallets : {};
2907
2966
  const userDid = String(data.owner?.creatorDid || wallets.userDid || '').trim();
2908
2967
  const primaryEvmWallet = String(wallets.primaryEvmWallet || data.owner?.creatorWallet || '').trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thirdfy/agent-cli",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "description": "Thirdfy Agent CLI for onboarding, governance preflight, execute-intent, and status polling.",
5
5
  "type": "module",
6
6
  "bin": {