@thirdfy/agent-cli 0.1.48 → 0.2.2

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 +48 -0
  2. package/README.md +25 -23
  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,54 @@ All notable changes to `@thirdfy/agent-cli` are documented here. The format is b
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.2.2] - 2026-05-23
8
+
9
+ ### Changed
10
+
11
+ - **npm README** — replaced the multi-version release wall with `## What's new in vX.Y.Z` (current semver only) and a CHANGELOG link; removed maintainer publish instructions from the npm homepage.
12
+ - **`validate:public-docs`** — enforces README/npm surface rules (current version heading, CHANGELOG link, no maintainer publish strings, max inline version highlights).
13
+ - **Cursor rules** — `npm-readme-surface.mdc` plus updates to public-docs and release flow rules; maintainer publish detail stays in `docs/releasing.md` / `docs-dev/publishing.md`.
14
+
15
+ ## [0.2.1] - 2026-05-23
16
+
17
+ ### Changed
18
+
19
+ - **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.
20
+ - Removed `dispatch.mjs` and the hybrid `parseArgs()` + `mergeCommanderGlobals()` entry path.
21
+ - Unknown CLI flags now error via Commander (previously ignored by the hand-rolled parser).
22
+ - Thirdfy API `GET /api/v1/agent/cli/capabilities` `profileDefaults.personal` aligned to `agent_wallet` (matches CLI `PROFILE_DEFAULTS`).
23
+
24
+ ### Added
25
+
26
+ - `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.
27
+ - `npm run validate:provider-parity`, `validate:cli-manifest-handlers`, `validate:runtime-boundaries`, `validate:release-preflight` (also `prepublishOnly`), and optional `validate:live-api-capabilities` when `THIRDFY_API_BASE` is set.
28
+ - Provider parity also asserts DogeOS provider ids (`dogeos-barkswap`, `dogeos-laika`, `dogeos-ecosystem`) in CLI selection + MCP.
29
+ - `test/commander-routing.test.cjs` — `-V`, `--version --json`, unknown command/option envelopes, `help onboarding`.
30
+
31
+ ### Fixed
32
+
33
+ - `-V` / `--version` no longer print the full Commander help tree before the version string (early argv handling before `parseAsync`).
34
+
35
+ ### Agent / operator notes
36
+
37
+ - **No argv path or JSON envelope changes** for documented commands; Hermes/OpenClaw/cron scripts need no changes.
38
+ - Optional Fly pin after publish: `THIRDFY_AGENT_CLI_PACKAGE=@thirdfy/agent-cli@0.2.1`.
39
+
40
+ ## [0.2.0] - 2026-05-23
41
+
42
+ ### Changed
43
+
44
+ - Modular CLI layout: `src/core/` (HTTP, context, envelope, run modes), `src/commands/` (execute, delegation, wallet, bootstrap, polymarket, hyperliquid), `src/cli/` (help + initial Commander globals).
45
+
46
+ ### Added
47
+
48
+ - `commander` dependency; `npm run validate:npm-pack` guards published tarball paths.
49
+ - `npm run e2e:local-api:smoke` — fail-fast smoke against a local Thirdfy API (`THIRDFY_API_BASE`, default `http://127.0.0.1:3000`).
50
+
51
+ ### Agent / operator notes
52
+
53
+ - **No argv or JSON envelope changes** for Hermes, OpenClaw, or cron scripts that invoke `thirdfy-agent` as a subprocess.
54
+
7
55
  ## [0.1.48] - 2026-05-23
8
56
 
9
57
  ### Fixed
package/README.md CHANGED
@@ -40,11 +40,12 @@ Run without global install:
40
40
  npx @thirdfy/agent-cli --help
41
41
  ```
42
42
 
43
- ## Release notes
43
+ ## What's new in v0.2.2
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
+ - **npm README cleanup** the registry homepage is user-facing again: one **What's new** section for the current version, full history in [CHANGELOG.md](./CHANGELOG.md) (no multi-version release wall or maintainer publish steps on npm).
46
+ - **Public docs validation** — `npm run validate:public-docs` enforces README/npm surface rules before publish.
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
+ Older highlights (Commander routing, stricter flags): see [CHANGELOG.md](./CHANGELOG.md) · [GitHub Releases](https://github.com/thirdfy/agent-cli/releases).
48
49
 
49
50
  ## Quick start
50
51
 
@@ -62,6 +63,15 @@ thirdfy-agent intent-status --intent-id "<intentId>" --json
62
63
 
63
64
  By default, the CLI targets production (`https://api.thirdfy.com`). Use `--api-base` (or `THIRDFY_API_BASE`) only for staging/dev/custom deployments.
64
65
 
66
+ ### Local API smoke
67
+
68
+ With Thirdfy API running locally (default `http://127.0.0.1:3000`):
69
+
70
+ ```bash
71
+ export THIRDFY_API_BASE=http://127.0.0.1:3000
72
+ npm run e2e:local-api:smoke
73
+ ```
74
+
65
75
  ## Auth model
66
76
 
67
77
  - `AGENT_API_KEY`: execution identity for `preflight`, `run`, `self-exec`, and policy-aware discovery.
@@ -303,6 +313,12 @@ Provider and venue guides are kept outside `README` so this page stays stable as
303
313
  - Delegation execution helpers: `delegation balance`, `delegation redeem`
304
314
  - Account: `credits balance`
305
315
 
316
+ ## CLI routing (Commander + runtime)
317
+
318
+ 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.
319
+
320
+ 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`.
321
+
306
322
  ## Where to find what is supported
307
323
 
308
324
  - Full command groups and usage map: [`docs/command-reference.md`](./docs/command-reference.md)
@@ -419,29 +435,15 @@ Managed-self execution performs strict wallet preflight and returns deterministi
419
435
  - Creator platform (agent registration and keys):
420
436
  [thirdfy.com/creator](https://thirdfy.com/creator)
421
437
 
422
- ## Development
438
+ ## Contributing
439
+
440
+ From a git clone of this repository:
423
441
 
424
442
  ```bash
425
- npm run validate:cli-contract-schemas
443
+ npm ci
444
+ npm run validate:public-docs
426
445
  npm test
427
446
  npm run smoke:cli
428
- npm run e2e:self:managed-custody-validation
429
- npm run e2e:managed:delegation:parity
430
447
  ```
431
448
 
432
- ## Release
433
-
434
- Version history and user-facing notes: [CHANGELOG.md](./CHANGELOG.md) (for example [v0.1.39](https://github.com/thirdfy/agent-cli/releases/tag/v0.1.39) — agent-wallet solo default, framework guidance, and delegation UX; [v0.1.38](https://github.com/thirdfy/agent-cli/releases/tag/v0.1.38) — npm README + lockfile metadata alignment; [v0.1.37](https://github.com/thirdfy/agent-cli/releases/tag/v0.1.37) — email OTP login, onboarding help, auth doctor, wallet list, masked `whoami`). **Before every version bump or npm publish:** update this **README** (release notes paragraph, quick start, and command groups) so the npm package page matches what ships; keep `CHANGELOG.md`, [command reference](./docs/command-reference.md), and MCP summaries aligned when discovery or onboarding surfaces change.
435
-
436
- ```bash
437
- npm version patch
438
- npm publish --access public
439
- git push origin main --follow-tags
440
- ```
441
-
442
- Release contract:
443
-
444
- - Keep `package.json` version and `CHANGELOG.md` synchronized in the release PR.
445
- - The git tag must be `vX.Y.Z` and match `package.json` exactly.
446
- - Push the matching tag so the [Release workflow](.github/workflows/release.yml) creates or aligns the GitHub release entry.
447
- - If npm already contains that version, the workflow skips republishing and still creates/aligns the GitHub release when triggered by the tag.
449
+ Version history lives in [CHANGELOG.md](./CHANGELOG.md). Maintainer publish steps: [docs/releasing.md](./docs/releasing.md).