@thirdfy/agent-cli 0.1.48 → 0.2.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +16 -1
  3. package/bin/thirdfy-agent.mjs +3 -5106
  4. package/package.json +17 -4
  5. package/scripts/validate-npm-pack.mjs +43 -0
  6. package/src/cli/errors.mjs +103 -0
  7. package/src/cli/flags.mjs +66 -0
  8. package/src/cli/help.mjs +89 -0
  9. package/src/cli/manifest.mjs +422 -0
  10. package/src/cli/options/agent.mjs +9 -0
  11. package/src/cli/options/analytics.mjs +5 -0
  12. package/src/cli/options/auth.mjs +10 -0
  13. package/src/cli/options/bootstrap.mjs +19 -0
  14. package/src/cli/options/chains.mjs +3 -0
  15. package/src/cli/options/credentials.mjs +15 -0
  16. package/src/cli/options/delegation.mjs +22 -0
  17. package/src/cli/options/execution.mjs +24 -0
  18. package/src/cli/options/global.mjs +16 -0
  19. package/src/cli/options/index.mjs +37 -0
  20. package/src/cli/options/polymarket.mjs +3 -0
  21. package/src/cli/options/tracking.mjs +18 -0
  22. package/src/cli/options/wallet.mjs +7 -0
  23. package/src/cli/program.mjs +5 -0
  24. package/src/cli/register.mjs +118 -0
  25. package/src/commands/agent.mjs +194 -0
  26. package/src/commands/bootstrap.mjs +762 -0
  27. package/src/commands/credentials.mjs +102 -0
  28. package/src/commands/delegation.mjs +355 -0
  29. package/src/commands/discovery.mjs +77 -0
  30. package/src/commands/doctor.mjs +320 -0
  31. package/src/commands/execute.mjs +255 -0
  32. package/src/commands/hyperliquid.mjs +51 -0
  33. package/src/commands/index.mjs +6 -0
  34. package/src/commands/polymarket.mjs +89 -0
  35. package/src/commands/prompt.mjs +33 -0
  36. package/src/commands/telemetry.mjs +146 -0
  37. package/src/commands/wallet.mjs +129 -0
  38. package/src/core/args.mjs +68 -0
  39. package/src/core/constants.mjs +31 -0
  40. package/src/core/context.mjs +145 -0
  41. package/src/core/envelope.mjs +20 -0
  42. package/src/core/http.mjs +77 -0
  43. package/src/core/index.mjs +6 -0
  44. package/src/core/runMode.mjs +72 -0
  45. package/src/runtime/actions/selection.mjs +339 -0
  46. package/src/runtime/agentExtract.mjs +52 -0
  47. package/src/runtime/authHelpers.mjs +53 -0
  48. package/src/runtime/bitfinexProbe.mjs +121 -0
  49. package/src/runtime/context.mjs +28 -0
  50. package/src/runtime/createThirdfyAgentRuntime.mjs +2 -0
  51. package/src/runtime/errors.mjs +3 -0
  52. package/src/runtime/execution/amounts.mjs +193 -0
  53. package/src/runtime/execution/lanes.mjs +75 -0
  54. package/src/runtime/execution/payloads.mjs +148 -0
  55. package/src/runtime/execution/runners.mjs +702 -0
  56. package/src/runtime/handlers.mjs +181 -0
  57. package/src/runtime/index.mjs +4 -0
  58. package/src/runtime/main.mjs +204 -0
  59. package/src/runtime/onboardingHints.mjs +54 -0
  60. package/src/runtime/owsSigning.mjs +118 -0
  61. package/src/runtime/providerHints.mjs +414 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,57 @@ All notable changes to `@thirdfy/agent-cli` are documented here. The format is b
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ### Added
8
+
9
+ - `src/runtime/` — organized CLI runtime layer: `main.mjs` (orchestration), `errors.mjs`, `onboardingHints.mjs`, `execution/*`, `actions/selection.mjs`, plus command factories under `src/commands/` (`discovery`, `telemetry`, `credentials`, `agent`, `doctor`, `prompt`). `bin/thirdfy-agent.mjs` remains a thin entrypoint.
10
+ - Maintainer-only operator docs (provider platform audit, Hermes post-publish smoke) moved out of npm-facing `docs/` paths.
11
+ - `npm run validate:provider-parity` — CI guard for earn/capyfi/fx/bridge/trading/hyperliquid/polymarket/bitfinex hints (reads `src/runtime/providerHints.mjs`).
12
+ - `npm run validate:cli-manifest-handlers` and `npm run validate:runtime-boundaries` — manifest handler coverage and import-boundary checks.
13
+ - `npm run validate:release-preflight` — full publish gate (lint, validators, tests, npm pack, smoke); `prepublishOnly` runs it.
14
+ - `npm run validate:live-api-capabilities` — optional post-deploy check when `THIRDFY_API_BASE` is set (`profileDefaults`, DogeOS chain routing).
15
+ - Provider parity script also asserts DogeOS provider ids (`dogeos-barkswap`, `dogeos-laika`, `dogeos-ecosystem`) in CLI selection + MCP.
16
+
17
+ ### Changed
18
+
19
+ - Thirdfy API `GET /api/v1/agent/cli/capabilities` `profileDefaults.personal` aligned to `agent_wallet` (matches CLI `PROFILE_DEFAULTS`).
20
+
21
+ ### Fixed
22
+
23
+ - `-V` / `--version` no longer print the full Commander help tree before the version string (early argv handling before `parseAsync`).
24
+ - Commander regression tests for clean `-V` / `--version` output.
25
+
26
+ ## [0.2.1] - 2026-05-23
27
+
28
+ ### Changed
29
+
30
+ - **Commander.js is now the active router**: `program.parseAsync()` registers all commands via `src/cli/manifest.mjs`, shared option bundles under `src/cli/options/`, and JSON-aware `exitOverride` handling. Handlers and envelopes remain 1:1 with 0.2.0.
31
+ - Removed `dispatch.mjs` and the hybrid `parseArgs()` + `mergeCommanderGlobals()` entry path.
32
+ - Unknown CLI flags now error via Commander (previously ignored by the hand-rolled parser).
33
+
34
+ ### Added
35
+
36
+ - `test/commander-routing.test.cjs` — `-V`, `--version --json`, unknown command/option envelopes, `help onboarding`.
37
+
38
+ ### Agent / operator notes
39
+
40
+ - **No argv path or JSON envelope changes** for documented commands; Hermes/OpenClaw/cron scripts need no changes.
41
+ - Optional Fly pin after publish: `THIRDFY_AGENT_CLI_PACKAGE=@thirdfy/agent-cli@0.2.1`.
42
+
43
+ ## [0.2.0] - 2026-05-23
44
+
45
+ ### Changed
46
+
47
+ - Modular CLI layout: `src/core/` (HTTP, context, envelope, run modes), `src/commands/` (execute, delegation, wallet, bootstrap, polymarket, hyperliquid), `src/cli/` (help + initial Commander globals).
48
+
49
+ ### Added
50
+
51
+ - `commander` dependency; `npm run validate:npm-pack` guards published tarball paths.
52
+ - `npm run e2e:local-api:smoke` — fail-fast smoke against a local Thirdfy API (`THIRDFY_API_BASE`, default `http://127.0.0.1:3000`).
53
+
54
+ ### Agent / operator notes
55
+
56
+ - **No argv or JSON envelope changes** for Hermes, OpenClaw, or cron scripts that invoke `thirdfy-agent` as a subprocess.
57
+
7
58
  ## [0.1.48] - 2026-05-23
8
59
 
9
60
  ### Fixed
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.48** fixes earn provider filtering so generic `deposit_earn_position` / `withdraw_earn_position` rows only appear for matching adapters (not unrelated morpho/vaults-fyi filters). **v0.1.47** adds CapyFi, FX, and bridge provider discovery hints. **v0.1.46** routes `polymarket status` through `get_polymarket_funding_status` with config `agentKey` and defaults dry-run to `place-polymarket-order` (pairs with API **v3.4.37**). **v0.1.45** adds `polymarket status`, `polymarket setup`, and `polymarket dry-run` for agent-scoped setup/geoblock preflight (pairs with API **v3.4.35**). **v0.1.44** adds Aegis provider hints for Base and Unichain earn reads and fail-closed Engine writes (pairs with API **v3.4.28**). **v0.1.43** injects Hyperliquid `userAddress` from the managed execution wallet for solo `agent_wallet` reads when omitted (pairs with API **v3.4.27**). **v0.1.42** persists API `executionWallets` from email login, updates `doctor auth` / onboarding help for agent execution wallet funding vs owner embedded auth wallet, and documents Bridge2 `FUND_AGENT_EXECUTION_WALLET` remediation (pairs with API **v3.4.25**). **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`.
45
+ Version history and highlights: [CHANGELOG.md](./CHANGELOG.md). **v0.2.1** ships full [Commander.js](https://github.com/tj/commander.js) routing (`parseAsync`, manifest-registered subcommands, JSON-aware errors) with **1:1 argv/envelope behavior** vs 0.1.x — Hermes/OpenClaw/cron scripts need no changes; optional Fly pin `@thirdfy/agent-cli@0.2.1` after publish. Unknown flags now error instead of being silently ignored. **v0.1.48** fixes earn provider filtering so generic `deposit_earn_position` / `withdraw_earn_position` rows only appear for matching adapters (not unrelated morpho/vaults-fyi filters). **v0.1.47** adds CapyFi, FX, and bridge provider discovery hints. **v0.1.46** routes `polymarket status` through `get_polymarket_funding_status` with config `agentKey` and defaults dry-run to `place-polymarket-order` (pairs with API **v3.4.37**). **v0.1.45** adds `polymarket status`, `polymarket setup`, and `polymarket dry-run` for agent-scoped setup/geoblock preflight (pairs with API **v3.4.35**). **v0.1.44** adds Aegis provider hints for Base and Unichain earn reads and fail-closed Engine writes (pairs with API **v3.4.28**). **v0.1.43** injects Hyperliquid `userAddress` from the managed execution wallet for solo `agent_wallet` reads when omitted (pairs with API **v3.4.27**). **v0.1.42** persists API `executionWallets` from email login, updates `doctor auth` / onboarding help for agent execution wallet funding vs owner embedded auth wallet, and documents Bridge2 `FUND_AGENT_EXECUTION_WALLET` remediation (pairs with API **v3.4.25**). **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
 
@@ -62,6 +62,15 @@ thirdfy-agent intent-status --intent-id "<intentId>" --json
62
62
 
63
63
  By default, the CLI targets production (`https://api.thirdfy.com`). Use `--api-base` (or `THIRDFY_API_BASE`) only for staging/dev/custom deployments.
64
64
 
65
+ ### Local API smoke
66
+
67
+ With Thirdfy API running locally (default `http://127.0.0.1:3000`):
68
+
69
+ ```bash
70
+ export THIRDFY_API_BASE=http://127.0.0.1:3000
71
+ npm run e2e:local-api:smoke
72
+ ```
73
+
65
74
  ## Auth model
66
75
 
67
76
  - `AGENT_API_KEY`: execution identity for `preflight`, `run`, `self-exec`, and policy-aware discovery.
@@ -303,6 +312,12 @@ Provider and venue guides are kept outside `README` so this page stays stable as
303
312
  - Delegation execution helpers: `delegation balance`, `delegation redeem`
304
313
  - Account: `credits balance`
305
314
 
315
+ ## CLI routing (Commander + runtime)
316
+
317
+ Since **v0.2.1**, [`bin/thirdfy-agent.mjs`](./bin/thirdfy-agent.mjs) is a thin entrypoint. Routing lives in [`src/cli/manifest.mjs`](./src/cli/manifest.mjs) (Commander `parseAsync`); behavior and handler wiring live in [`src/runtime/`](./src/runtime/). JSON envelopes, subcommand paths, and global flags (`--json`, `--api-base`, `--run-mode`, …) match **0.1.x** for documented flows. **Unknown flags now error** instead of being silently ignored. Built-in Commander `help` is disabled so `thirdfy-agent help onboarding` keeps working.
318
+
319
+ Maintainers validating releases locally: `npm run validate:release-preflight`. After API deploy: `THIRDFY_API_BASE=https://api.thirdfy.com npm run validate:live-api-capabilities`.
320
+
306
321
  ## Where to find what is supported
307
322
 
308
323
  - Full command groups and usage map: [`docs/command-reference.md`](./docs/command-reference.md)