@thirdfy/agent-cli 0.2.11 → 0.2.14
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 +18 -0
- package/README.md +2 -3
- package/package.json +1 -1
- package/src/commands/execute.mjs +7 -2
- package/src/commands/index.mjs +1 -0
- package/src/commands/lighter.mjs +52 -0
- package/src/commands/wallet.mjs +4 -1
- package/src/core/http.mjs +37 -1
- package/src/runtime/actions/selection.mjs +20 -2
- package/src/runtime/execution/lanes.mjs +11 -1
- package/src/runtime/handlers.mjs +9 -0
- package/src/runtime/providerHints.mjs +92 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ All notable changes to `@thirdfy/agent-cli` are documented here. The format is b
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.2.14] - 2026-06-24
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- HTTP client (`src/core/http.mjs`) retries once on **502/503/504** and timeout/abort errors with short jittered backoff. Pairs with Thirdfy API **v3.5.6+** Supabase REST resilience (`UPSTREAM_DB_UNAVAILABLE`).
|
|
12
|
+
|
|
13
|
+
## [0.2.13] - 2026-06-23
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Lighter provider hints: Base-first `complete_lighter_onboarding` lead action and catalog-aligned names for CCTP funding, API-key setup, and integrator approval. Pairs with Thirdfy API **v3.5.3+** and `thirdfy-mcp` **v0.0.62+**.
|
|
18
|
+
|
|
19
|
+
## [0.2.12] - 2026-06-22
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- Lighter perps provider: `lighter` command group, provider hints, execution lanes, and wallet helpers for CCTP funding discovery, market reads, API-key setup, and signed perps writes. Pairs with Thirdfy API **v3.5.2+** and `thirdfy-mcp` **v0.0.61+**.
|
|
24
|
+
|
|
7
25
|
## [0.2.11] - 2026-06-17
|
|
8
26
|
|
|
9
27
|
### Changed
|
package/README.md
CHANGED
|
@@ -40,10 +40,9 @@ Run without global install:
|
|
|
40
40
|
npx @thirdfy/agent-cli --help
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
## What's new in v0.2.
|
|
43
|
+
## What's new in v0.2.14
|
|
44
44
|
|
|
45
|
-
-
|
|
46
|
-
- Public docs no longer imply you need an Allora API key in the CLI. Allora reads bill through Thirdfy credits like other provider actions.
|
|
45
|
+
- HTTP client retries once on Thirdfy API **502/503/504** and client timeouts (bounded `AbortController`), so PostgREST outages surface as transient failures instead of hanging Hermes read cycles. Pairs with Thirdfy API **v3.5.6+**.
|
|
47
46
|
|
|
48
47
|
Older versions: see [CHANGELOG.md](./CHANGELOG.md) and [GitHub Releases](https://github.com/thirdfy/agent-cli/releases).
|
|
49
48
|
|
package/package.json
CHANGED
package/src/commands/execute.mjs
CHANGED
|
@@ -19,6 +19,7 @@ export function createExecuteCommands(deps) {
|
|
|
19
19
|
enforceOffchainVenueLaneCompatibility,
|
|
20
20
|
enforceChainCompatibility,
|
|
21
21
|
applyHyperliquidAgentWalletAddressDefault,
|
|
22
|
+
applyLighterAgentWalletAddressDefault,
|
|
22
23
|
runPreflightByMode,
|
|
23
24
|
runExecutionByMode,
|
|
24
25
|
applyExecutionFallbackHints,
|
|
@@ -38,7 +39,9 @@ async function commandPreflight(ctx, flags, capabilities) {
|
|
|
38
39
|
enforceOffchainVenueLaneCompatibility(resolved.resolvedAction, runMode);
|
|
39
40
|
const hybridWalletMode = runMode === 'hybrid' ? normalizeHybridWalletMode(flags.hybridWalletMode) : null;
|
|
40
41
|
enforceChainCompatibility(capabilities, flags, runMode);
|
|
41
|
-
const managedPreflight =
|
|
42
|
+
const managedPreflight =
|
|
43
|
+
(await applyHyperliquidAgentWalletAddressDefault(ctx, flags, resolved, runMode))
|
|
44
|
+
|| (await applyLighterAgentWalletAddressDefault(ctx, flags, resolved, runMode));
|
|
42
45
|
const backendResult = await runPreflightByMode(runMode, ctx, flags, resolved, { hybridWalletMode, managedPreflight });
|
|
43
46
|
const normalized = applyExecutionFallbackHints(backendResult.normalized, {
|
|
44
47
|
flags,
|
|
@@ -88,7 +91,9 @@ async function commandRun(ctx, flags, capabilities) {
|
|
|
88
91
|
enforceOffchainVenueLaneCompatibility(resolved.resolvedAction, runMode);
|
|
89
92
|
const hybridWalletMode = runMode === 'hybrid' ? normalizeHybridWalletMode(flags.hybridWalletMode) : null;
|
|
90
93
|
enforceChainCompatibility(capabilities, flags, runMode);
|
|
91
|
-
const managedPreflight =
|
|
94
|
+
const managedPreflight =
|
|
95
|
+
(await applyHyperliquidAgentWalletAddressDefault(ctx, flags, resolved, runMode))
|
|
96
|
+
|| (await applyLighterAgentWalletAddressDefault(ctx, flags, resolved, runMode));
|
|
92
97
|
const skipPreflight = Boolean(flags.skipPreflight);
|
|
93
98
|
const backendResult = await runExecutionByMode(runMode, ctx, flags, resolved, {
|
|
94
99
|
skipPreflight,
|
package/src/commands/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createPolymarketCommands, resolveConfigAgentKey } from './polymarket.mjs';
|
|
2
2
|
export { createHyperliquidHelpers } from './hyperliquid.mjs';
|
|
3
|
+
export { createLighterHelpers } from './lighter.mjs';
|
|
3
4
|
export { createExecuteCommands } from './execute.mjs';
|
|
4
5
|
export { createWalletCommands } from './wallet.mjs';
|
|
5
6
|
export { createDelegationCommands } from './delegation.mjs';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { parseJsonFlag } from '../core/args.mjs';
|
|
2
|
+
|
|
3
|
+
export function createLighterHelpers(deps) {
|
|
4
|
+
const { getPreparedParams, resolveManagedExecutionPreflight } = deps;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function lighterDefaultAddressParamForAction(action) {
|
|
8
|
+
const canonical = String(action || '').trim().toLowerCase().replace(/_/g, '-');
|
|
9
|
+
if (
|
|
10
|
+
canonical === 'get-lighter-open-orders'
|
|
11
|
+
|| canonical === 'get-lighter-user-state'
|
|
12
|
+
) {
|
|
13
|
+
return 'userAddress';
|
|
14
|
+
}
|
|
15
|
+
if (
|
|
16
|
+
canonical === 'get-lighter-account'
|
|
17
|
+
|| canonical === 'get-lighter-setup-status'
|
|
18
|
+
|| canonical === 'get-lighter-funding-status'
|
|
19
|
+
|| canonical === 'get-lighter-onboarding-plan'
|
|
20
|
+
|| canonical === 'prepare-lighter-onboarding'
|
|
21
|
+
|| canonical === 'complete-lighter-onboarding'
|
|
22
|
+
|| canonical === 'create-lighter-deposit-intent'
|
|
23
|
+
) {
|
|
24
|
+
return 'l1Address';
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
async function applyLighterAgentWalletAddressDefault(ctx, flags, resolved, runMode) {
|
|
31
|
+
if (runMode !== 'agent_wallet') return null;
|
|
32
|
+
const paramName = lighterDefaultAddressParamForAction(resolved?.resolvedAction);
|
|
33
|
+
if (!paramName) return null;
|
|
34
|
+
const params = getPreparedParams(flags);
|
|
35
|
+
if (String(params?.[paramName] || '').trim()) return null;
|
|
36
|
+
const preflight = await resolveManagedExecutionPreflight(ctx, flags, resolved, {
|
|
37
|
+
runMode: 'agent_wallet',
|
|
38
|
+
requireFundingCheck: false,
|
|
39
|
+
});
|
|
40
|
+
if (!preflight.success || !preflight.executionWalletAddress) return preflight;
|
|
41
|
+
flags.__preparedParams = {
|
|
42
|
+
...(params || {}),
|
|
43
|
+
[paramName]: preflight.executionWalletAddress,
|
|
44
|
+
};
|
|
45
|
+
return preflight;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
lighterDefaultAddressParamForAction,
|
|
50
|
+
applyLighterAgentWalletAddressDefault,
|
|
51
|
+
};
|
|
52
|
+
}
|
package/src/commands/wallet.mjs
CHANGED
|
@@ -9,6 +9,7 @@ export function createWalletCommands(deps) {
|
|
|
9
9
|
enforceOffchainVenueLaneCompatibility,
|
|
10
10
|
enforceChainCompatibility,
|
|
11
11
|
applyHyperliquidAgentWalletAddressDefault,
|
|
12
|
+
applyLighterAgentWalletAddressDefault,
|
|
12
13
|
executeManagedWalletRun,
|
|
13
14
|
executeSelfRun,
|
|
14
15
|
submitSignedTx,
|
|
@@ -21,7 +22,9 @@ async function commandWalletExecute(ctx, flags, capabilities) {
|
|
|
21
22
|
const resolved = await resolveActionSelection(ctx, normalizedFlags);
|
|
22
23
|
prepareActionParamsForFlags(normalizedFlags, resolved.resolvedAction);
|
|
23
24
|
enforceChainCompatibility(capabilities, normalizedFlags, 'agent_wallet');
|
|
24
|
-
const managedPreflight =
|
|
25
|
+
const managedPreflight =
|
|
26
|
+
(await applyHyperliquidAgentWalletAddressDefault(ctx, normalizedFlags, resolved, 'agent_wallet'))
|
|
27
|
+
|| (await applyLighterAgentWalletAddressDefault(ctx, normalizedFlags, resolved, 'agent_wallet'));
|
|
25
28
|
const skipPreflight = Boolean(normalizedFlags.skipPreflight);
|
|
26
29
|
const result = await executeManagedWalletRun(ctx, normalizedFlags, resolved, { skipPreflight, managedPreflight });
|
|
27
30
|
printEnvelope({
|
package/src/core/http.mjs
CHANGED
|
@@ -4,6 +4,25 @@ import {
|
|
|
4
4
|
resolveExecutionContextFromInput,
|
|
5
5
|
} from './executionContext.mjs';
|
|
6
6
|
|
|
7
|
+
function sleep(ms) {
|
|
8
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function isRetryableApiStatus(statusCode) {
|
|
12
|
+
return statusCode === 502 || statusCode === 503 || statusCode === 504;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function isRetryableApiError(error) {
|
|
16
|
+
const statusCode = Number(error?.statusCode || 0);
|
|
17
|
+
const message = String(error?.message || '').toLowerCase();
|
|
18
|
+
return (
|
|
19
|
+
isRetryableApiStatus(statusCode) ||
|
|
20
|
+
error?.name === 'AbortError' ||
|
|
21
|
+
message.includes('abort') ||
|
|
22
|
+
message.includes('timeout')
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
7
26
|
export async function apiGet(ctx, route, headers = {}) {
|
|
8
27
|
return requestJson(ctx, route, { method: 'GET', headers: mergeExecutionContextHeaders(headers) });
|
|
9
28
|
}
|
|
@@ -28,7 +47,7 @@ export async function apiPost(ctx, route, body, headers = {}) {
|
|
|
28
47
|
});
|
|
29
48
|
}
|
|
30
49
|
|
|
31
|
-
|
|
50
|
+
async function requestJsonOnce(ctx, route, init) {
|
|
32
51
|
const controller = new AbortController();
|
|
33
52
|
const timeout = setTimeout(() => controller.abort(), ctx.timeoutMs);
|
|
34
53
|
try {
|
|
@@ -50,6 +69,23 @@ export async function requestJson(ctx, route, init) {
|
|
|
50
69
|
}
|
|
51
70
|
}
|
|
52
71
|
|
|
72
|
+
export async function requestJson(ctx, route, init) {
|
|
73
|
+
let lastError = null;
|
|
74
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
75
|
+
try {
|
|
76
|
+
return await requestJsonOnce(ctx, route, init);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
lastError = error;
|
|
79
|
+
if (attempt === 0 && isRetryableApiError(error)) {
|
|
80
|
+
await sleep(250 + Math.floor(Math.random() * 250));
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
throw lastError || new Error('Request failed');
|
|
87
|
+
}
|
|
88
|
+
|
|
53
89
|
export async function requestWithRouteFallback(ctx, options) {
|
|
54
90
|
const routes = Array.isArray(options.routes) ? options.routes : [];
|
|
55
91
|
let lastError = null;
|
|
@@ -93,6 +93,22 @@ function inferActionProvider(action) {
|
|
|
93
93
|
'get-perps-position': 'hyperliquid',
|
|
94
94
|
'place-perps-order': 'hyperliquid',
|
|
95
95
|
'cancel-perps-order': 'hyperliquid',
|
|
96
|
+
'get-lighter-perps-meta': 'lighter',
|
|
97
|
+
'get-lighter-all-mids': 'lighter',
|
|
98
|
+
'search-lighter-markets': 'lighter',
|
|
99
|
+
'get-lighter-l2-book': 'lighter',
|
|
100
|
+
'get-lighter-candles': 'lighter',
|
|
101
|
+
'get-lighter-user-state': 'lighter',
|
|
102
|
+
'get-lighter-open-orders': 'lighter',
|
|
103
|
+
'get-lighter-setup-status': 'lighter',
|
|
104
|
+
'get-lighter-funding-status': 'lighter',
|
|
105
|
+
'get-lighter-onboarding-plan': 'lighter',
|
|
106
|
+
'prepare-lighter-onboarding': 'lighter',
|
|
107
|
+
'approve-lighter-agent': 'lighter',
|
|
108
|
+
'deposit-lighter-cctp': 'lighter',
|
|
109
|
+
'place-lighter-perps-order': 'lighter',
|
|
110
|
+
'cancel-lighter-perps-order': 'lighter',
|
|
111
|
+
'update-lighter-leverage': 'lighter',
|
|
96
112
|
'get-earn-opportunities': 'earn',
|
|
97
113
|
'get-earn-provider': 'earn',
|
|
98
114
|
'get-earn-position': 'earn',
|
|
@@ -146,6 +162,7 @@ function inferActionProvider(action) {
|
|
|
146
162
|
};
|
|
147
163
|
if (knownMap[key]) return knownMap[key];
|
|
148
164
|
if (key.includes('hyperliquid')) return 'hyperliquid';
|
|
165
|
+
if (key.includes('lighter')) return 'lighter';
|
|
149
166
|
if (key.includes('bitfinex')) return 'bitfinex';
|
|
150
167
|
if (key.includes('polymarket') || key.includes('prediction')) return 'polymarket';
|
|
151
168
|
if (key.includes('vaults-fyi')) return 'vaults-fyi';
|
|
@@ -214,10 +231,11 @@ function actionMatchesProvider(action, requestedProvider, allActions) {
|
|
|
214
231
|
if (requestedProvider === 'trading') return isSpotTradingCatalogAction(action);
|
|
215
232
|
// Here resolved metadata already disagrees with the filter; fall back to action-key shape only.
|
|
216
233
|
if (requestedProvider === 'hyperliquid') return isProviderActionKey(action, 'hyperliquid');
|
|
234
|
+
if (requestedProvider === 'lighter') return isProviderActionKey(action, 'lighter');
|
|
217
235
|
if (requestedProvider === 'polymarket') return isProviderActionKey(action, 'polymarket');
|
|
218
236
|
if (requestedProvider === 'bridge') {
|
|
219
|
-
// Hyperliquid Bridge2 setup actions are owned by
|
|
220
|
-
if (provider === 'hyperliquid') return false;
|
|
237
|
+
// Hyperliquid Bridge2 and Lighter CCTP setup actions are owned by their perps providers, not cross-chain bridge.
|
|
238
|
+
if (provider === 'hyperliquid' || provider === 'lighter') return false;
|
|
221
239
|
return isProviderActionKey(action, 'bridge');
|
|
222
240
|
}
|
|
223
241
|
if (requestedProvider.startsWith('dogeos')) return isProviderActionKey(action, requestedProvider);
|
|
@@ -7,6 +7,16 @@ const OFFCHAIN_VENUE_ORDER_ACTIONS = new Set([
|
|
|
7
7
|
'cancel-hyperliquid-perps-order',
|
|
8
8
|
'update_hyperliquid_leverage',
|
|
9
9
|
'update-hyperliquid-leverage',
|
|
10
|
+
'place_lighter_perps_order',
|
|
11
|
+
'place-lighter-perps-order',
|
|
12
|
+
'cancel_lighter_perps_order',
|
|
13
|
+
'cancel-lighter-perps-order',
|
|
14
|
+
'update_lighter_leverage',
|
|
15
|
+
'update-lighter-leverage',
|
|
16
|
+
'modify_lighter_perps_order',
|
|
17
|
+
'modify-lighter-perps-order',
|
|
18
|
+
'update_lighter_margin',
|
|
19
|
+
'update-lighter-margin',
|
|
10
20
|
'place_polymarket_order',
|
|
11
21
|
'place-polymarket-order',
|
|
12
22
|
]);
|
|
@@ -15,7 +25,7 @@ function enforceOffchainVenueLaneCompatibility(action, runMode) {
|
|
|
15
25
|
if (runMode !== 'self' || !OFFCHAIN_VENUE_ORDER_ACTIONS.has(normalizedAction)) return;
|
|
16
26
|
throw createCliError(
|
|
17
27
|
'OFFCHAIN_VENUE_ORDER_SELF_UNSUPPORTED',
|
|
18
|
-
'Polymarket CLOB and
|
|
28
|
+
'Polymarket CLOB, Hyperliquid perps, and Lighter perps orders are offchain signed API actions, not EVM build-tx actions. Use self for setup/funding signatures, then run venue orders with --run-mode thirdfy, --run-mode hybrid, or --run-mode agent_wallet.',
|
|
19
29
|
{
|
|
20
30
|
recommendedRunModes: ['thirdfy', 'hybrid', 'agent_wallet'],
|
|
21
31
|
setupOnlyRunMode: 'self',
|
package/src/runtime/handlers.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { negotiateCapabilities } from '../core/http.mjs';
|
|
2
2
|
import { createPolymarketCommands } from '../commands/polymarket.mjs';
|
|
3
3
|
import { createHyperliquidHelpers } from '../commands/hyperliquid.mjs';
|
|
4
|
+
import { createLighterHelpers } from '../commands/lighter.mjs';
|
|
4
5
|
import { createExecuteCommands } from '../commands/execute.mjs';
|
|
5
6
|
import { createWalletCommands } from '../commands/wallet.mjs';
|
|
6
7
|
import { createDelegationCommands } from '../commands/delegation.mjs';
|
|
@@ -93,12 +94,19 @@ export function createRuntimeHandlers(deps) {
|
|
|
93
94
|
});
|
|
94
95
|
const { applyHyperliquidAgentWalletAddressDefault } = __hyperliquid;
|
|
95
96
|
|
|
97
|
+
const __lighter = createLighterHelpers({
|
|
98
|
+
getPreparedParams,
|
|
99
|
+
resolveManagedExecutionPreflight,
|
|
100
|
+
});
|
|
101
|
+
const { applyLighterAgentWalletAddressDefault } = __lighter;
|
|
102
|
+
|
|
96
103
|
const __wallet = createWalletCommands({
|
|
97
104
|
resolveActionSelection,
|
|
98
105
|
prepareActionParamsForFlags,
|
|
99
106
|
enforceOffchainVenueLaneCompatibility,
|
|
100
107
|
enforceChainCompatibility,
|
|
101
108
|
applyHyperliquidAgentWalletAddressDefault,
|
|
109
|
+
applyLighterAgentWalletAddressDefault,
|
|
102
110
|
executeManagedWalletRun,
|
|
103
111
|
executeSelfRun,
|
|
104
112
|
submitSignedTx,
|
|
@@ -111,6 +119,7 @@ export function createRuntimeHandlers(deps) {
|
|
|
111
119
|
enforceOffchainVenueLaneCompatibility,
|
|
112
120
|
enforceChainCompatibility,
|
|
113
121
|
applyHyperliquidAgentWalletAddressDefault,
|
|
122
|
+
applyLighterAgentWalletAddressDefault,
|
|
114
123
|
runPreflightByMode,
|
|
115
124
|
runExecutionByMode,
|
|
116
125
|
applyExecutionFallbackHints,
|
|
@@ -14,7 +14,7 @@ export function createProviderHints({ getNegotiatedCapabilitiesCache }) {
|
|
|
14
14
|
supportedChains: [1, 10, 130, 137, 8453, 84532, 42161],
|
|
15
15
|
laneCompatibility:
|
|
16
16
|
'Kyber quote/build is live on Ethereum, Optimism, Unichain, Polygon, Base, and Arbitrum; sponsored Kyber execution is validated on Base only. Gnosis FX uses the fx provider via CoW.',
|
|
17
|
-
credentialUx: 'Use normal Thirdfy login/delegation; do not use this provider for Hyperliquid or Polymarket.',
|
|
17
|
+
credentialUx: 'Use normal Thirdfy login/delegation; do not use this provider for Hyperliquid, Lighter, or Polymarket.',
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
if (provider === 'hyperliquid') {
|
|
@@ -106,6 +106,96 @@ export function createProviderHints({ getNegotiatedCapabilitiesCache }) {
|
|
|
106
106
|
'thirdfy-agent actions --provider hyperliquid && thirdfy-agent preflight --action place_hyperliquid_perps_order --params \'{"coin":"ETH","isBuy":true,"size":0.01,"limitPx":3500,"orderType":"market"}\'',
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
+
if (provider === 'lighter') {
|
|
110
|
+
return {
|
|
111
|
+
provider,
|
|
112
|
+
category: 'leveraged_perps',
|
|
113
|
+
canonicalWriteAction: 'place_lighter_perps_order',
|
|
114
|
+
readActions: [
|
|
115
|
+
'get_lighter_markets',
|
|
116
|
+
'search_lighter_markets',
|
|
117
|
+
'get_lighter_order_book',
|
|
118
|
+
'get_lighter_candles',
|
|
119
|
+
'get_lighter_funding_rates',
|
|
120
|
+
'get_lighter_account',
|
|
121
|
+
'get_lighter_positions',
|
|
122
|
+
'get_lighter_open_orders',
|
|
123
|
+
'get_lighter_pnl',
|
|
124
|
+
'get_lighter_funding_status',
|
|
125
|
+
'get_lighter_setup_status',
|
|
126
|
+
'get_lighter_onboarding_plan',
|
|
127
|
+
'get_lighter_integrator_status',
|
|
128
|
+
'get_lighter_partner_stats',
|
|
129
|
+
],
|
|
130
|
+
orderManagementActions: [
|
|
131
|
+
'place_lighter_perps_order',
|
|
132
|
+
'cancel_lighter_perps_order',
|
|
133
|
+
'modify_lighter_perps_order',
|
|
134
|
+
'update_lighter_leverage',
|
|
135
|
+
'update_lighter_margin',
|
|
136
|
+
'get_lighter_open_orders',
|
|
137
|
+
],
|
|
138
|
+
setupActions: [
|
|
139
|
+
'get_lighter_funding_status',
|
|
140
|
+
'get_lighter_setup_status',
|
|
141
|
+
'get_lighter_onboarding_plan',
|
|
142
|
+
'prepare_lighter_onboarding',
|
|
143
|
+
'complete_lighter_onboarding',
|
|
144
|
+
'create_lighter_deposit_intent',
|
|
145
|
+
'setup_lighter_api_key',
|
|
146
|
+
'create_lighter_api_key',
|
|
147
|
+
'register_lighter_api_key',
|
|
148
|
+
'approve_lighter_integrator',
|
|
149
|
+
'get_bridge_quote',
|
|
150
|
+
'execute_bridge',
|
|
151
|
+
],
|
|
152
|
+
statusActions: [
|
|
153
|
+
'get_lighter_funding_status',
|
|
154
|
+
'get_lighter_setup_status',
|
|
155
|
+
'get_lighter_integrator_status',
|
|
156
|
+
],
|
|
157
|
+
recoveryActions: [
|
|
158
|
+
'get_lighter_account',
|
|
159
|
+
'get_lighter_withdrawal_status',
|
|
160
|
+
'prepare_lighter_secure_withdrawal',
|
|
161
|
+
],
|
|
162
|
+
decommissionExample:
|
|
163
|
+
'get_lighter_account -> prepare_lighter_secure_withdrawal -> withdraw-to-user on execution wallet',
|
|
164
|
+
credentialType: 'lighter_api_key',
|
|
165
|
+
credentialUx:
|
|
166
|
+
'Delegated Lighter writes require encrypted lighter_api_key credentials: privateKey, apiKeyIndex (4-254), and accountIndex. Upsert via delegation credentials before place_lighter_perps_order.',
|
|
167
|
+
recommendedFundingChainId: 8453,
|
|
168
|
+
supportedFundingSourceChains: [
|
|
169
|
+
{ chainId: 8453, name: 'Base', path: 'native USDC -> CCTP intent -> Lighter margin (recommended)' },
|
|
170
|
+
{ chainId: 42161, name: 'Arbitrum One', path: 'Li.Fi -> Base USDC -> CCTP intent -> Lighter margin' },
|
|
171
|
+
{ chainId: 43114, name: 'Avalanche', path: 'Li.Fi -> Base USDC -> CCTP intent -> Lighter margin' },
|
|
172
|
+
{ chainId: 1, name: 'Ethereum', path: 'Priority changePubKey registration only (chainId 1)' },
|
|
173
|
+
],
|
|
174
|
+
setupBlockers: [
|
|
175
|
+
'LIGHTER_SOURCE_FUNDS_REQUIRED',
|
|
176
|
+
'LIGHTER_DEPOSIT_REQUIRED',
|
|
177
|
+
'LIGHTER_ACCOUNT_NOT_FOUND',
|
|
178
|
+
'LIGHTER_API_KEY_REGISTRATION_REQUIRED',
|
|
179
|
+
'LIGHTER_INTEGRATOR_APPROVAL_REQUIRED',
|
|
180
|
+
'LIGHTER_POLICY_REQUIRED',
|
|
181
|
+
'LIGHTER_CREDITS_REQUIRED',
|
|
182
|
+
'LIGHTER_SIGNER_NOT_CONFIGURED',
|
|
183
|
+
],
|
|
184
|
+
setupWarnings: [
|
|
185
|
+
'LIGHTER_API_KEY_NOT_PROVIDED',
|
|
186
|
+
'LIGHTER_INTEGRATOR_ACCOUNT_UNFUNDED',
|
|
187
|
+
],
|
|
188
|
+
sourceBridgeProvider: 'lifi',
|
|
189
|
+
funding:
|
|
190
|
+
'Run complete_lighter_onboarding on Base (chainId 8453) for automated Li.Fi, CCTP intent, and USDC transfer. API key registration uses an Ethereum priority changePubKey transaction (chainId 1). Minimum CCTP deposit is 5 USDC.',
|
|
191
|
+
laneCompatibility:
|
|
192
|
+
'Use agent_wallet for automated complete_lighter_onboarding (CCTP on Base, priority changePubKey on Ethereum). Perps writes use thirdfy, hybrid, or agent_wallet with a stored lighter_api_key credential. Gator covers EVM funding and setup only, not L2 orders.',
|
|
193
|
+
setupExample:
|
|
194
|
+
'actions --provider lighter -> complete_lighter_onboarding (chainId 8453, agent_wallet) -> re-run after CCTP credit -> setup_lighter_api_key on chainId 1 when prompted -> credentials upsert lighter_api_key (auto on agent_wallet) -> get_lighter_setup_status -> place_lighter_perps_order',
|
|
195
|
+
example:
|
|
196
|
+
'thirdfy-agent actions --provider lighter && thirdfy-agent preflight --action place_lighter_perps_order --params \'{"accountIndex":1,"apiKeyIndex":4,"marketId":0,"baseAmount":100,"price":310000,"isAsk":false,"orderType":"limit"}\'',
|
|
197
|
+
};
|
|
198
|
+
}
|
|
109
199
|
if (provider === 'bitfinex') {
|
|
110
200
|
return {
|
|
111
201
|
provider,
|
|
@@ -381,6 +471,7 @@ export function createProviderHints({ getNegotiatedCapabilitiesCache }) {
|
|
|
381
471
|
const canonicalWriteActions = {
|
|
382
472
|
trading: 'swap',
|
|
383
473
|
hyperliquid: 'place_hyperliquid_perps_order',
|
|
474
|
+
lighter: 'place_lighter_perps_order',
|
|
384
475
|
polymarket: 'place_polymarket_order',
|
|
385
476
|
prediction: 'place_prediction_order',
|
|
386
477
|
earn: 'deposit_earn_position',
|