@thirdfy/agent-cli 0.2.17 → 0.2.18

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.2.18] - 2026-07-02
8
+
9
+ ### Changed
10
+
11
+ - `credits balance`, `credits models list`, and `credits models estimate` human-readable summaries lead with USD when the API returns `availableUsd`, `estimatedUsdPerTurn`, or `chargedUsd` (Thirdfy API **v3.9.5+** USD credits Phase 1). JSON output unchanged. Pairs with `thirdfy-mcp` **v0.0.67+**.
12
+
7
13
  ## [0.2.17] - 2026-07-02
8
14
 
9
15
  ### Changed
package/README.md CHANGED
@@ -40,9 +40,9 @@ Run without global install:
40
40
  npx @thirdfy/agent-cli --help
41
41
  ```
42
42
 
43
- ## What's new in v0.2.17
43
+ ## What's new in v0.2.18
44
44
 
45
- - Lighter onboarding writes (`complete_lighter_onboarding`, `setup_lighter_api_key`, `register_lighter_api_key`) use a 180s HTTP timeout by default so `run` and `wallet execute` do not abort before CCTP credit or Ethereum `changePubKey` completes. Override with `THIRDFY_CLI_LONG_TIMEOUT_MS`. Pairs with Thirdfy API **v3.9.4+** and `thirdfy-mcp` **v0.0.66+**.
45
+ - Credits commands show USD-first summaries when the API returns Phase 1 display fields: balance (`availableUsd`), model list (`estimatedUsdPerTurn`), and estimates (`chargedUsd`). Use `--json` for the full API payload. Pairs with Thirdfy API **v3.9.5+** and `thirdfy-mcp` **v0.0.67+**.
46
46
 
47
47
  Older versions: see [CHANGELOG.md](./CHANGELOG.md) and [GitHub Releases](https://github.com/thirdfy/agent-cli/releases).
48
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thirdfy/agent-cli",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
4
4
  "description": "Thirdfy Agent CLI for onboarding, governance preflight, execute-intent, and status polling.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,6 +11,7 @@
11
11
  "src/core/",
12
12
  "src/commands/",
13
13
  "src/cli/",
14
+ "src/lib/",
14
15
  "src/runtime/",
15
16
  "src/utils/cli/",
16
17
  "src/contracts/cli/schemas/",
@@ -1,5 +1,9 @@
1
1
  import { requireFlag } from '../core/args.mjs';
2
2
  import { apiGet, apiPost } from '../core/http.mjs';
3
+ import {
4
+ formatCreditsEstimateSummary,
5
+ formatCreditsModelsSummary,
6
+ } from '../lib/creditsUsdSummary.mjs';
3
7
 
4
8
  function resolveToolCallsEstimate(flags) {
5
9
  const raw = flags.toolCalls ?? flags.toolCallsList;
@@ -67,10 +71,7 @@ export function createCreditsCommands({ printEnvelope, getAuthToken }) {
67
71
  const response = await apiGet(ctx, '/api/v1/credits/pricing/models', {
68
72
  Authorization: `Bearer ${authToken}`,
69
73
  });
70
- const firstModel = response?.models?.[0];
71
- const summary = firstModel?.estimatedUsdPerTurn != null
72
- ? `${response?.models?.length ?? 0} models · e.g. ${firstModel.modelKey} ~$${Number(firstModel.estimatedUsdPerTurn).toFixed(2)}/turn`
73
- : `${response?.models?.length ?? 0} models loaded`;
74
+ const summary = formatCreditsModelsSummary(response);
74
75
  printEnvelope({
75
76
  success: true,
76
77
  code: 'OK',
@@ -99,9 +100,7 @@ export function createCreditsCommands({ printEnvelope, getAuthToken }) {
99
100
  { Authorization: `Bearer ${authToken}` },
100
101
  );
101
102
  const estimate = response?.estimate;
102
- const summary = estimate?.chargedUsd != null
103
- ? `~$${Number(estimate.chargedUsd).toFixed(2)} charged (${estimate.chargedCredits ?? estimate.totalCredits} credits)`
104
- : `${estimate?.chargedCredits ?? estimate?.totalCredits ?? '?'} credits`;
103
+ const summary = formatCreditsEstimateSummary(estimate);
105
104
  printEnvelope({
106
105
  success: true,
107
106
  code: 'OK',
@@ -2,6 +2,7 @@ import { requireFlag, parseJsonFlag } from '../core/args.mjs';
2
2
  import { apiGet, apiPost } from '../core/http.mjs';
3
3
  import { extractActions, getCachedActionsCatalog } from '../core/context.mjs';
4
4
  import { getEffectiveRunMode } from '../core/runMode.mjs';
5
+ import { formatCreditsBalanceSummary } from '../lib/creditsUsdSummary.mjs';
5
6
  export function createDiscoveryCommands({ printEnvelope, applyActionFilters, getTradingProviderHint, resolveChainSupport, getAuthToken, resolveAgentApiKey }) {
6
7
  async function commandCatalogsList(ctx, flags, capabilities) {
7
8
  const response = await apiGet(ctx, '/api/v1/agent/actions/catalog');
@@ -57,10 +58,7 @@ async function commandCreditsBalance(ctx, flags, capabilities) {
57
58
  const response = await apiGet(ctx, '/api/v1/credits/balance', {
58
59
  Authorization: `Bearer ${authToken}`,
59
60
  });
60
- const summary =
61
- typeof response?.availableUsd === 'number'
62
- ? `$${response.availableUsd.toFixed(2)} available (${response.balance ?? 0} credits)`
63
- : `${response?.balance ?? 0} credits`;
61
+ const summary = formatCreditsBalanceSummary(response);
64
62
  printEnvelope({
65
63
  success: true,
66
64
  code: 'OK',
@@ -0,0 +1,21 @@
1
+ export function formatCreditsBalanceSummary(response) {
2
+ if (typeof response?.availableUsd === 'number') {
3
+ return `$${response.availableUsd.toFixed(2)} available (${response.balance ?? 0} credits)`;
4
+ }
5
+ return `${response?.balance ?? 0} credits`;
6
+ }
7
+
8
+ export function formatCreditsModelsSummary(response) {
9
+ const firstModel = response?.models?.[0];
10
+ if (firstModel?.estimatedUsdPerTurn != null) {
11
+ return `${response?.models?.length ?? 0} models · e.g. ${firstModel.modelKey} ~$${Number(firstModel.estimatedUsdPerTurn).toFixed(2)}/turn`;
12
+ }
13
+ return `${response?.models?.length ?? 0} models loaded`;
14
+ }
15
+
16
+ export function formatCreditsEstimateSummary(estimate) {
17
+ if (estimate?.chargedUsd != null) {
18
+ return `~$${Number(estimate.chargedUsd).toFixed(2)} charged (${estimate.chargedCredits ?? estimate.totalCredits} credits)`;
19
+ }
20
+ return `${estimate?.chargedCredits ?? estimate?.totalCredits ?? '?'} credits`;
21
+ }