@thirdfy/agent-cli 0.2.15 → 0.2.16

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.16] - 2026-06-30
8
+
9
+ ### Added
10
+
11
+ - `credits` command group: `balance`, `transactions` (with `includeMetadata`), `usage`, `models list`, `models estimate`, and `pricing quote`. Passes `toolCallsList` into pricing estimate for action-tier line items. Pairs with Thirdfy API **v3.8.2+** and `thirdfy-mcp` **v0.0.65+**.
12
+
7
13
  ## [0.2.15] - 2026-06-26
8
14
 
9
15
  ### Added
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.15
43
+ ## What's new in v0.2.16
44
44
 
45
- - `hummingbot` command group for governed Condor CEX executor ops: `status`, `connectors`, `executor-schema`, `executor-create`. Provider runbook at [`docs/providers/hummingbot.md`](./docs/providers/hummingbot.md). Pairs with Thirdfy API **v3.6.0+** and `thirdfy-mcp` **v0.0.64+**.
45
+ - `credits` commands for balance, transactions (optional billing metadata), usage summary, model pricing, turn estimate, and action quote. Pairs with Thirdfy API **v3.8.2+** and `thirdfy-mcp` **v0.0.65+**.
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.15",
3
+ "version": "0.2.16",
4
4
  "description": "Thirdfy Agent CLI for onboarding, governance preflight, execute-intent, and status polling.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli/help.mjs CHANGED
@@ -68,6 +68,11 @@ Core commands:
68
68
  thirdfy-agent prompt "<natural language prompt>" [--json]
69
69
  thirdfy-agent intent-status --intent-id <id> [--json]
70
70
  thirdfy-agent credits balance --auth-token <token> [--json]
71
+ thirdfy-agent credits transactions --auth-token <token> [--page <n>] [--limit <n>] [--include-metadata] [--json]
72
+ thirdfy-agent credits usage --auth-token <token> [--range 7d|30d|90d] [--json]
73
+ thirdfy-agent models list --auth-token <token> [--json]
74
+ thirdfy-agent models estimate --auth-token <token> --model <key> [--input-tokens <n>] [--output-tokens <n>] [--json]
75
+ thirdfy-agent pricing quote --auth-token <token> --action <action-key> [--chain-id <id>] [--json]
71
76
 
72
77
  Global flags:
73
78
  --api-base <url> default: https://api.thirdfy.com
@@ -161,6 +161,41 @@ export const CLI_MANIFEST = [
161
161
  options: ['auth'],
162
162
  description: 'Credits balance',
163
163
  },
164
+ {
165
+ path: ['credits', 'transactions'],
166
+ handler: 'commandCreditsTransactions',
167
+ tier: 'online',
168
+ options: ['auth', 'credits'],
169
+ description: 'Paginated credit transactions with optional billing metadata',
170
+ },
171
+ {
172
+ path: ['credits', 'usage'],
173
+ handler: 'commandCreditsUsage',
174
+ tier: 'online',
175
+ options: ['auth', 'credits'],
176
+ description: 'Credits usage summary by model, provider, and action',
177
+ },
178
+ {
179
+ path: ['models', 'list'],
180
+ handler: 'commandModelsList',
181
+ tier: 'online',
182
+ options: ['auth'],
183
+ description: 'List model pricing from chat_model_catalog',
184
+ },
185
+ {
186
+ path: ['models', 'estimate'],
187
+ handler: 'commandModelsEstimate',
188
+ tier: 'online',
189
+ options: ['auth', 'credits', 'execution'],
190
+ description: 'Estimate model and action credits before execution',
191
+ },
192
+ {
193
+ path: ['pricing', 'quote'],
194
+ handler: 'commandPricingQuote',
195
+ tier: 'online',
196
+ options: ['auth', 'execution'],
197
+ description: 'Quote action-tier credits for a catalog action',
198
+ },
164
199
  {
165
200
  path: ['data', 'summary'],
166
201
  handler: 'commandDataSummary',
@@ -0,0 +1,15 @@
1
+ export function attachCreditsOptions(cmd) {
2
+ return cmd
3
+ .option('--page <n>', 'page number for transactions', '1')
4
+ .option('--limit <n>', 'page size for transactions', '20')
5
+ .option('--include-metadata', 'include unified billing metadata on transactions')
6
+ .option('--range <range>', 'usage summary range (7d, 30d, 90d)', '7d')
7
+ .option('--model <key>', 'chat model key for pricing estimate')
8
+ .option('--input-tokens <n>', 'estimated input tokens for pricing estimate', '0')
9
+ .option('--output-tokens <n>', 'estimated output tokens for pricing estimate', '0')
10
+ .option(
11
+ '--tool-calls <value>',
12
+ 'tool call count or comma-separated AgentKit tool names for pricing estimate',
13
+ )
14
+ .option('--surface <surface>', 'billing surface (console, automation, cli, agent_api)', 'cli');
15
+ }
@@ -11,6 +11,7 @@ import { attachPolymarketOptions } from './polymarket.mjs';
11
11
  import { attachHummingbotOptions } from './hummingbot.mjs';
12
12
  import { attachAgentRegisterOptions } from './agent.mjs';
13
13
  import { attachChainOptions } from './chains.mjs';
14
+ import { attachCreditsOptions } from './credits.mjs';
14
15
 
15
16
  const BUNDLES = {
16
17
  auth: attachAuthOptions,
@@ -25,6 +26,7 @@ const BUNDLES = {
25
26
  hummingbot: attachHummingbotOptions,
26
27
  agent: attachAgentRegisterOptions,
27
28
  chains: attachChainOptions,
29
+ credits: attachCreditsOptions,
28
30
  };
29
31
 
30
32
  /** @param {import('commander').Command} cmd */
@@ -0,0 +1,134 @@
1
+ import { requireFlag } from '../core/args.mjs';
2
+ import { apiGet, apiPost } from '../core/http.mjs';
3
+
4
+ function resolveToolCallsEstimate(flags) {
5
+ const raw = flags.toolCalls ?? flags.toolCallsList;
6
+ if (raw == null || raw === '') {
7
+ return { toolCalls: 0, toolCallsList: undefined };
8
+ }
9
+
10
+ const value = String(raw).trim();
11
+ if (!value) {
12
+ return { toolCalls: 0, toolCallsList: undefined };
13
+ }
14
+
15
+ if (/^\d+$/.test(value)) {
16
+ return { toolCalls: Number(value), toolCallsList: undefined };
17
+ }
18
+
19
+ const toolCallsList = value
20
+ .split(',')
21
+ .map((entry) => entry.trim())
22
+ .filter(Boolean);
23
+
24
+ return {
25
+ toolCalls: toolCallsList.length,
26
+ toolCallsList,
27
+ };
28
+ }
29
+
30
+ export function createCreditsCommands({ printEnvelope, getAuthToken }) {
31
+ async function commandCreditsTransactions(ctx, flags) {
32
+ const authToken = getAuthToken(flags, 'Missing --auth-token (or THIRDFY_AUTH_TOKEN) for credits transactions');
33
+ const page = Number(flags.page || 1);
34
+ const limit = Number(flags.limit || 20);
35
+ const includeMetadata = flags.includeMetadata === true || flags.includeMetadata === 'true';
36
+ const response = await apiGet(
37
+ ctx,
38
+ `/api/v1/credits/transactions?page=${page}&limit=${limit}&includeMetadata=${includeMetadata}`,
39
+ { Authorization: `Bearer ${authToken}` },
40
+ );
41
+ printEnvelope({
42
+ success: true,
43
+ code: 'OK',
44
+ message: 'Credit transactions loaded',
45
+ data: response,
46
+ meta: { apiBase: ctx.apiBase, page, limit, includeMetadata },
47
+ });
48
+ }
49
+
50
+ async function commandCreditsUsage(ctx, flags) {
51
+ const authToken = getAuthToken(flags, 'Missing --auth-token (or THIRDFY_AUTH_TOKEN) for credits usage');
52
+ const range = String(flags.range || '7d');
53
+ const response = await apiGet(ctx, `/api/v1/credits/usage/summary?range=${encodeURIComponent(range)}`, {
54
+ Authorization: `Bearer ${authToken}`,
55
+ });
56
+ printEnvelope({
57
+ success: true,
58
+ code: 'OK',
59
+ message: 'Credits usage summary loaded',
60
+ data: response,
61
+ meta: { apiBase: ctx.apiBase, range },
62
+ });
63
+ }
64
+
65
+ async function commandModelsList(ctx, flags) {
66
+ const authToken = getAuthToken(flags, 'Missing --auth-token (or THIRDFY_AUTH_TOKEN) for models list');
67
+ const response = await apiGet(ctx, '/api/v1/credits/pricing/models', {
68
+ Authorization: `Bearer ${authToken}`,
69
+ });
70
+ printEnvelope({
71
+ success: true,
72
+ code: 'OK',
73
+ message: 'Model pricing loaded',
74
+ data: response,
75
+ meta: { apiBase: ctx.apiBase },
76
+ });
77
+ }
78
+
79
+ async function commandModelsEstimate(ctx, flags) {
80
+ const authToken = getAuthToken(flags, 'Missing --auth-token (or THIRDFY_AUTH_TOKEN) for models estimate');
81
+ const modelKey = requireFlag(flags, 'model', 'Missing --model for models estimate');
82
+ const { toolCalls, toolCallsList } = resolveToolCallsEstimate(flags);
83
+ const response = await apiPost(
84
+ ctx,
85
+ '/api/v1/credits/pricing/estimate',
86
+ {
87
+ modelKey,
88
+ inputTokens: Number(flags.inputTokens || 0),
89
+ outputTokens: Number(flags.outputTokens || 0),
90
+ toolCalls,
91
+ toolCallsList,
92
+ chainId: Number(flags.chainId || 0) || undefined,
93
+ surface: flags.surface || 'cli',
94
+ },
95
+ { Authorization: `Bearer ${authToken}` },
96
+ );
97
+ printEnvelope({
98
+ success: true,
99
+ code: 'OK',
100
+ message: 'Model estimate generated',
101
+ data: response,
102
+ meta: { apiBase: ctx.apiBase, modelKey },
103
+ });
104
+ }
105
+
106
+ async function commandPricingQuote(ctx, flags) {
107
+ const authToken = getAuthToken(flags, 'Missing --auth-token (or THIRDFY_AUTH_TOKEN) for pricing quote');
108
+ const action = requireFlag(flags, 'action', 'Missing --action for pricing quote');
109
+ const response = await apiPost(
110
+ ctx,
111
+ '/api/v1/credits/pricing/quote',
112
+ {
113
+ actionKey: action,
114
+ chainId: Number(flags.chainId || 8453),
115
+ },
116
+ { Authorization: `Bearer ${authToken}` },
117
+ );
118
+ printEnvelope({
119
+ success: true,
120
+ code: 'OK',
121
+ message: 'Action pricing quote generated',
122
+ data: response,
123
+ meta: { apiBase: ctx.apiBase, action },
124
+ });
125
+ }
126
+
127
+ return {
128
+ commandCreditsTransactions,
129
+ commandCreditsUsage,
130
+ commandModelsList,
131
+ commandModelsEstimate,
132
+ commandPricingQuote,
133
+ };
134
+ }
@@ -8,6 +8,7 @@ import { createWalletCommands } from '../commands/wallet.mjs';
8
8
  import { createDelegationCommands } from '../commands/delegation.mjs';
9
9
  import { createBootstrapCommands } from '../commands/bootstrap.mjs';
10
10
  import { createDiscoveryCommands } from '../commands/discovery.mjs';
11
+ import { createCreditsCommands } from '../commands/credits.mjs';
11
12
  import { createTelemetryCommands } from '../commands/telemetry.mjs';
12
13
  import { createCredentialsCommands } from '../commands/credentials.mjs';
13
14
  import { createAgentCommands } from '../commands/agent.mjs';
@@ -56,6 +57,11 @@ export function createRuntimeHandlers(deps) {
56
57
  resolveAgentApiKey,
57
58
  });
58
59
 
60
+ const __credits = createCreditsCommands({
61
+ printEnvelope,
62
+ getAuthToken,
63
+ });
64
+
59
65
  const __telemetry = createTelemetryCommands({
60
66
  printEnvelope,
61
67
  resolveAgentApiKey,
@@ -179,6 +185,11 @@ export function createRuntimeHandlers(deps) {
179
185
  commandCatalogsList: __discovery.commandCatalogsList,
180
186
  commandActions: __discovery.commandActions,
181
187
  commandCreditsBalance: __discovery.commandCreditsBalance,
188
+ commandCreditsTransactions: __credits.commandCreditsTransactions,
189
+ commandCreditsUsage: __credits.commandCreditsUsage,
190
+ commandModelsList: __credits.commandModelsList,
191
+ commandModelsEstimate: __credits.commandModelsEstimate,
192
+ commandPricingQuote: __credits.commandPricingQuote,
182
193
  commandDataSummary: __telemetry.commandDataSummary,
183
194
  commandTrackList: __telemetry.commandTrackList,
184
195
  commandTrackAction: __telemetry.commandTrackAction,