@thirdfy/agent-cli 0.2.77 → 0.2.79
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 +27 -0
- package/README.md +8 -8
- package/package.json +2 -2
- package/scripts/validate-cli-contract-schemas.mjs +1 -0
- package/src/cli/manifest.mjs +9 -2
- package/src/cli/options/data.mjs +14 -0
- package/src/cli/options/index.mjs +3 -0
- package/src/commands/avantis.mjs +7 -4
- package/src/commands/condor.mjs +6 -5
- package/src/commands/credits.mjs +3 -1
- package/src/commands/doctor.mjs +5 -4
- package/src/commands/execute.mjs +28 -22
- package/src/commands/hummingbot.mjs +7 -6
- package/src/commands/polymarket.mjs +2 -1
- package/src/commands/signals/command.mjs +39 -0
- package/src/commands/signals/signalRows.mjs +153 -0
- package/src/commands/signals/typedReading.mjs +55 -0
- package/src/commands/telemetry.mjs +5 -1
- package/src/commands/venue.mjs +5 -2
- package/src/commands/wallet.mjs +3 -3
- package/src/contracts/cli/schemas/signals.response.schema.json +78 -0
- package/src/core/actionTimeouts.mjs +4 -5
- package/src/core/envelope.mjs +46 -7
- package/src/core/venueBrand.mjs +76 -0
- package/src/runtime/actions/selection.mjs +66 -18
- package/src/runtime/certification/executionCertify.mjs +3 -1
- package/src/runtime/certification/venueActionSchemas.mjs +5 -3
- package/src/runtime/execution/lanes.mjs +4 -2
- package/src/runtime/execution/payloads.mjs +3 -4
- package/src/runtime/execution/runners.mjs +1 -1
- package/src/runtime/handlers.mjs +4 -0
- package/src/runtime/main.mjs +4 -4
- package/src/runtime/providerHints.mjs +92 -65
package/src/runtime/main.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
|
-
import { printEnvelope as corePrintEnvelope } from '../core/envelope.mjs';
|
|
2
|
+
import { exitAfterOutput, printEnvelope as corePrintEnvelope } from '../core/envelope.mjs';
|
|
3
3
|
import { negotiateCapabilities } from '../core/http.mjs';
|
|
4
4
|
import {
|
|
5
5
|
buildCliProgram,
|
|
@@ -38,7 +38,7 @@ export function createThirdfyAgentRuntime() {
|
|
|
38
38
|
process.argv.includes('--json') ||
|
|
39
39
|
(cliProgram ? cliProgram.opts()?.json : false)
|
|
40
40
|
);
|
|
41
|
-
corePrintEnvelope(payload, { jsonMode });
|
|
41
|
+
corePrintEnvelope(payload, { jsonMode, humanLead: options.humanLead, humanData: options.humanData });
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function prepareContextFromFlags(flags) {
|
|
@@ -174,7 +174,7 @@ export function createThirdfyAgentRuntime() {
|
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
176
|
const exitCode = Number(error.exitCode ?? 1);
|
|
177
|
-
|
|
177
|
+
await exitAfterOutput(exitCode);
|
|
178
178
|
}
|
|
179
179
|
throw error;
|
|
180
180
|
}
|
|
@@ -204,7 +204,7 @@ export function createThirdfyAgentRuntime() {
|
|
|
204
204
|
},
|
|
205
205
|
meta: { version: CLI_VERSION, apiBase: context.apiBase },
|
|
206
206
|
});
|
|
207
|
-
|
|
207
|
+
return exitAfterOutput(1);
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
return {
|
|
@@ -1,9 +1,27 @@
|
|
|
1
|
+
import { normalizeVenueProviderId } from '../core/venueBrand.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Veranta (formerly Avantis) naming for the `avantis` / `avantis-vault` hints, static or from the
|
|
5
|
+
* capabilities manifest. Empty for every other provider.
|
|
6
|
+
*/
|
|
7
|
+
function verantaNamingFields(provider) {
|
|
8
|
+
if (provider !== 'avantis' && provider !== 'avantis-vault') return {};
|
|
9
|
+
const alias = provider === 'avantis' ? 'veranta' : 'veranta-vault';
|
|
10
|
+
return {
|
|
11
|
+
displayName: 'Veranta',
|
|
12
|
+
formerName: 'Avantis',
|
|
13
|
+
providerAliases: [alias],
|
|
14
|
+
actionNaming: `Veranta (formerly Avantis). Veranta action names (*_veranta_*) are canonical; Avantis names (*_avantis_*) still resolve. Provider id stays ${provider}; --provider ${alias} is an alias.`,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
1
18
|
/**
|
|
2
19
|
* Static and capabilities-backed provider discovery hints for CLI actions filtering.
|
|
3
20
|
*/
|
|
4
21
|
export function createProviderHints({ getNegotiatedCapabilitiesCache }) {
|
|
5
22
|
function getTradingProviderHint(providerId) {
|
|
6
|
-
|
|
23
|
+
// `veranta` / `veranta-vault` resolve to the internal `avantis` / `avantis-vault` hints.
|
|
24
|
+
const provider = normalizeVenueProviderId(providerId || '');
|
|
7
25
|
const manifestHint = getCachedProviderHintFromCapabilities(provider);
|
|
8
26
|
const setupHints =
|
|
9
27
|
manifestHint?.setupHints && typeof manifestHint.setupHints === 'object' ? manifestHint.setupHints : {};
|
|
@@ -206,68 +224,69 @@ export function createProviderHints({ getNegotiatedCapabilitiesCache }) {
|
|
|
206
224
|
if (provider === 'avantis') {
|
|
207
225
|
return {
|
|
208
226
|
provider,
|
|
227
|
+
...verantaNamingFields(provider),
|
|
209
228
|
category: 'leveraged_perps',
|
|
210
|
-
canonicalWriteAction: '
|
|
229
|
+
canonicalWriteAction: 'place_veranta_perps_order',
|
|
211
230
|
readActions: [
|
|
212
|
-
'
|
|
213
|
-
'
|
|
214
|
-
'
|
|
215
|
-
'
|
|
216
|
-
'
|
|
217
|
-
'
|
|
218
|
-
'
|
|
219
|
-
'
|
|
220
|
-
'
|
|
221
|
-
'
|
|
222
|
-
'
|
|
223
|
-
'
|
|
224
|
-
'
|
|
225
|
-
'
|
|
231
|
+
'get_veranta_markets',
|
|
232
|
+
'get_veranta_pair',
|
|
233
|
+
'get_veranta_price',
|
|
234
|
+
'get_veranta_spread',
|
|
235
|
+
'get_veranta_positions',
|
|
236
|
+
'get_veranta_open_orders',
|
|
237
|
+
'get_veranta_allowance',
|
|
238
|
+
'get_veranta_delegation_status',
|
|
239
|
+
'get_veranta_funding_status',
|
|
240
|
+
'get_veranta_setup_status',
|
|
241
|
+
'get_veranta_onboarding_plan',
|
|
242
|
+
'get_veranta_builder_fee_status',
|
|
243
|
+
'get_veranta_referral_status',
|
|
244
|
+
'get_veranta_referral_stats',
|
|
226
245
|
],
|
|
227
246
|
orderManagementActions: [
|
|
228
|
-
'
|
|
229
|
-
'
|
|
230
|
-
'
|
|
231
|
-
'
|
|
232
|
-
'
|
|
233
|
-
'
|
|
234
|
-
'
|
|
235
|
-
'
|
|
236
|
-
'
|
|
237
|
-
'
|
|
238
|
-
'
|
|
239
|
-
'
|
|
240
|
-
'
|
|
241
|
-
'
|
|
242
|
-
'
|
|
247
|
+
'place_veranta_perps_order',
|
|
248
|
+
'cancel_veranta_perps_order',
|
|
249
|
+
'close_veranta_position',
|
|
250
|
+
'update_veranta_tp_sl',
|
|
251
|
+
'cancel_veranta_tp_sl',
|
|
252
|
+
'place_veranta_twap_order',
|
|
253
|
+
'close_veranta_twap_order',
|
|
254
|
+
'cancel_veranta_twap_order',
|
|
255
|
+
'place_veranta_coin_perps_order',
|
|
256
|
+
'increase_veranta_coin_position',
|
|
257
|
+
'close_veranta_coin_position',
|
|
258
|
+
'place_veranta_mm_order',
|
|
259
|
+
'cancel_veranta_mm_order',
|
|
260
|
+
'get_veranta_open_orders',
|
|
261
|
+
'get_veranta_positions',
|
|
243
262
|
],
|
|
244
263
|
setupActions: [
|
|
245
|
-
'
|
|
246
|
-
'
|
|
247
|
-
'
|
|
248
|
-
'
|
|
249
|
-
'
|
|
250
|
-
'
|
|
251
|
-
'
|
|
252
|
-
'
|
|
253
|
-
'
|
|
254
|
-
'
|
|
264
|
+
'get_veranta_funding_status',
|
|
265
|
+
'get_veranta_setup_status',
|
|
266
|
+
'get_veranta_onboarding_plan',
|
|
267
|
+
'prepare_veranta_onboarding',
|
|
268
|
+
'complete_veranta_onboarding',
|
|
269
|
+
'approve_veranta_builder_fee',
|
|
270
|
+
'revoke_veranta_builder_fee',
|
|
271
|
+
'set_veranta_referral_code',
|
|
272
|
+
'register_veranta_referral_code',
|
|
273
|
+
'claim_veranta_referral_rebate',
|
|
255
274
|
],
|
|
256
275
|
statusActions: [
|
|
257
|
-
'
|
|
258
|
-
'
|
|
259
|
-
'
|
|
260
|
-
'
|
|
276
|
+
'get_veranta_funding_status',
|
|
277
|
+
'get_veranta_setup_status',
|
|
278
|
+
'get_veranta_builder_fee_status',
|
|
279
|
+
'get_veranta_delegation_status',
|
|
261
280
|
],
|
|
262
281
|
recoveryActions: [
|
|
263
|
-
'
|
|
264
|
-
'
|
|
282
|
+
'get_veranta_positions',
|
|
283
|
+
'close_veranta_position',
|
|
265
284
|
],
|
|
266
285
|
decommissionExample:
|
|
267
|
-
'
|
|
286
|
+
'get_veranta_positions -> close_veranta_position -> withdraw-to-user on execution wallet (Base USDC)',
|
|
268
287
|
credentialType: 'avantis_delegate',
|
|
269
288
|
credentialUx:
|
|
270
|
-
'Thirdfy mints and stores the encrypted
|
|
289
|
+
'Thirdfy mints and stores the encrypted Veranta delegate. CLI callers use Thirdfy auth only. Do not paste a private key.',
|
|
271
290
|
recommendedFundingChainId: 8453,
|
|
272
291
|
supportedFundingSourceChains: [
|
|
273
292
|
{ chainId: 8453, name: 'Base', path: 'native USDC in managed execution wallet (recommended)' },
|
|
@@ -283,32 +302,33 @@ export function createProviderHints({ getNegotiatedCapabilitiesCache }) {
|
|
|
283
302
|
funding:
|
|
284
303
|
'Fund the managed execution wallet on Base (8453) with native USDC. Minimum collateral follows the live catalog notional floor.',
|
|
285
304
|
laneCompatibility:
|
|
286
|
-
'Use agent_wallet for solo managed-wallet onboarding and perps writes after avantis_delegate credential is stored. Use thirdfy or hybrid for delegated capital. Thirdfy builds EIP-712 intents; the delegate credential signs batched-market submissions. Relayer is default. Builder-fee collection stays unwired until
|
|
305
|
+
'Use agent_wallet for solo managed-wallet onboarding and perps writes after avantis_delegate credential is stored. Use thirdfy or hybrid for delegated capital. Thirdfy builds EIP-712 intents; the delegate credential signs batched-market submissions. Relayer is default. Builder-fee collection stays unwired until Veranta supplies a fee-enabled template.',
|
|
287
306
|
setupExample:
|
|
288
|
-
'actions --provider
|
|
307
|
+
'actions --provider veranta -> get_veranta_funding_status -> complete_veranta_onboarding (agent_wallet on Base 8453) -> get_veranta_setup_status before place_veranta_perps_order. Do not call approve_veranta_builder_fee until setup status shows a wired template.',
|
|
289
308
|
example:
|
|
290
|
-
'thirdfy-agent actions --provider
|
|
309
|
+
'thirdfy-agent actions --provider veranta && thirdfy-agent preflight --action place_veranta_perps_order --params \'{"pairIndex":0,"side":"long","collateralUsdc":10,"leverage":10,"orderType":"market"}\'',
|
|
291
310
|
};
|
|
292
311
|
}
|
|
293
312
|
if (provider === 'avantis-vault') {
|
|
294
313
|
return {
|
|
295
314
|
provider,
|
|
315
|
+
...verantaNamingFields(provider),
|
|
296
316
|
category: 'earn',
|
|
297
|
-
canonicalReadAction: '
|
|
298
|
-
canonicalWriteAction: '
|
|
299
|
-
readActions: ['
|
|
317
|
+
canonicalReadAction: 'get_veranta_vault_info',
|
|
318
|
+
canonicalWriteAction: 'deposit_veranta_vault',
|
|
319
|
+
readActions: ['get_veranta_vault_info', 'get_veranta_vault_position'],
|
|
300
320
|
orderManagementActions: [
|
|
301
|
-
'
|
|
302
|
-
'
|
|
303
|
-
'
|
|
304
|
-
'
|
|
321
|
+
'deposit_veranta_vault',
|
|
322
|
+
'request_veranta_vault_withdrawal',
|
|
323
|
+
'redeem_veranta_vault',
|
|
324
|
+
'claim_veranta_vault',
|
|
305
325
|
],
|
|
306
326
|
recommendedFundingChainId: 8453,
|
|
307
327
|
supportedChains: [8453],
|
|
308
328
|
funding: 'Fund the managed execution wallet on Base with native USDC before vault deposit.',
|
|
309
|
-
laneCompatibility: 'Avantis LP vault on Base. Use agent_wallet, thirdfy, or hybrid. Relayer is default.',
|
|
329
|
+
laneCompatibility: 'Veranta (formerly Avantis) LP vault on Base. Use agent_wallet, thirdfy, or hybrid. Relayer is default.',
|
|
310
330
|
example:
|
|
311
|
-
'thirdfy-agent actions --provider
|
|
331
|
+
'thirdfy-agent actions --provider veranta-vault && thirdfy-agent run --action get_veranta_vault_info --provider veranta-vault --json',
|
|
312
332
|
};
|
|
313
333
|
}
|
|
314
334
|
if (provider === 'bitfinex') {
|
|
@@ -901,12 +921,12 @@ export function createProviderHints({ getNegotiatedCapabilitiesCache }) {
|
|
|
901
921
|
}
|
|
902
922
|
|
|
903
923
|
function getCachedProviderHintFromCapabilities(provider) {
|
|
904
|
-
const normalizedProvider =
|
|
924
|
+
const normalizedProvider = normalizeVenueProviderId(provider || '');
|
|
905
925
|
if (!normalizedProvider) return null;
|
|
906
926
|
const manifests = Array.isArray(getNegotiatedCapabilitiesCache()?.providers?.manifests)
|
|
907
927
|
? getNegotiatedCapabilitiesCache().providers.manifests
|
|
908
928
|
: [];
|
|
909
|
-
const match = manifests.find((entry) =>
|
|
929
|
+
const match = manifests.find((entry) => normalizeVenueProviderId(entry?.providerId || '') === normalizedProvider);
|
|
910
930
|
if (!match) return null;
|
|
911
931
|
const canonicalWriteActions = {
|
|
912
932
|
trading: 'swap',
|
|
@@ -958,13 +978,20 @@ export function createProviderHints({ getNegotiatedCapabilitiesCache }) {
|
|
|
958
978
|
custodyMode: match.custodyMode || null,
|
|
959
979
|
description: match.description || null,
|
|
960
980
|
source: 'cli_capabilities_manifest',
|
|
981
|
+
...verantaNamingFields(normalizedProvider),
|
|
961
982
|
...(match.setupHints && typeof match.setupHints === 'object' ? { setupHints: match.setupHints } : {}),
|
|
962
983
|
};
|
|
963
984
|
}
|
|
964
985
|
|
|
986
|
+
// Veranta hints carry `providerAliases`; show the public name in messages (`--provider veranta`).
|
|
987
|
+
function providerLabelForHint(providerHint) {
|
|
988
|
+
const alias = Array.isArray(providerHint?.providerAliases) ? providerHint.providerAliases[0] : null;
|
|
989
|
+
return alias || providerHint.provider;
|
|
990
|
+
}
|
|
991
|
+
|
|
965
992
|
function formatProviderAmbiguousActionHint(providerHint) {
|
|
966
993
|
if (!providerHint) return '';
|
|
967
|
-
const p = providerHint
|
|
994
|
+
const p = providerLabelForHint(providerHint);
|
|
968
995
|
const w = providerHint.canonicalWriteAction;
|
|
969
996
|
if (w) return ` Provider ${p} expects ${w}.`;
|
|
970
997
|
return ` Provider ${p} did not declare a canonical write action in capabilities; run actions --provider ${p} first.`;
|
|
@@ -972,7 +999,7 @@ export function createProviderHints({ getNegotiatedCapabilitiesCache }) {
|
|
|
972
999
|
|
|
973
1000
|
function formatProviderUnknownActionHint(providerHint) {
|
|
974
1001
|
if (!providerHint) return '';
|
|
975
|
-
const p = providerHint
|
|
1002
|
+
const p = providerLabelForHint(providerHint);
|
|
976
1003
|
const w = providerHint.canonicalWriteAction;
|
|
977
1004
|
if (w) return ` Provider ${p} expects ${w}; run actions --provider ${p} first.`;
|
|
978
1005
|
return ` Provider ${p} did not declare a canonical write action in capabilities; run actions --provider ${p} first.`;
|