@thirdfy/agent-cli 0.2.67 → 0.2.69
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,18 @@ All notable changes to `@thirdfy/agent-cli` are documented here. The format is b
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.2.69] - 2026-09-16
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Managed `agent_wallet` reads do not fall back to `/execute-intent` on `PARAMS_SCHEMA_INVALID` / unknown-key. Fallback stays limited to `does not support execute rail`. Matches `thirdfy-mcp` **0.0.119**. Pin: `test/agent-wallet-readonly-fallback.test.cjs`.
|
|
12
|
+
|
|
13
|
+
## [0.2.68] - 2026-09-16
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Merge `--confirmWrites` / `--confirm` into execute params and default `estimatedAmountUsd` to `1` for `complete_avantis_onboarding` when omitted. Matches MCP `walletExecute` so Claude-style root confirmation reaches AgentKit. Pairs with `thirdfy-mcp` **0.0.118** and Thirdfy API **3.14.44**. Pin: `test/avantis-agent-wallet-defaults.test.cjs`.
|
|
18
|
+
|
|
7
19
|
## [0.2.67] - 2026-09-15
|
|
8
20
|
|
|
9
21
|
### Added
|
package/README.md
CHANGED
|
@@ -40,10 +40,10 @@ 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.69
|
|
44
44
|
|
|
45
|
-
- `
|
|
46
|
-
-
|
|
45
|
+
- Managed `agent_wallet` reads keep `/execute` errors such as Avantis `get_avantis_price` unknown `symbols`. They do not fall back to an empty execute-intent queue.
|
|
46
|
+
- Execute-intent fallback stays limited to `does not support execute rail`.
|
|
47
47
|
- See [CHANGELOG.md](./CHANGELOG.md) and GitHub Releases for older versions.
|
|
48
48
|
|
|
49
49
|
## Quick start
|
package/package.json
CHANGED
|
@@ -9,6 +9,9 @@ export function attachExecutionOptions(cmd) {
|
|
|
9
9
|
.option('--estimated-amount-usd <usd>', 'estimated amount USD')
|
|
10
10
|
.option('--broadcast', 'with run --run-mode self, sign and broadcast using OWS')
|
|
11
11
|
.option('--skip-preflight', 'skip preflight')
|
|
12
|
+
.option('--confirm-writes', 'Confirm write execution')
|
|
13
|
+
.option('--confirmWrites', 'Alias of --confirm-writes')
|
|
14
|
+
.option('--confirm', 'Alias of --confirm-writes')
|
|
12
15
|
.option('--user-did <did>', 'user DID for managed paths')
|
|
13
16
|
.option('--allow-wallet-mismatch', 'bypass strict funded-wallet vs execution-wallet guard')
|
|
14
17
|
.option('--execution-scope <scope>', 'execution scope')
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Managed `agent_wallet` reads prefer `/execute`. Execute-intent is only a fallback when that
|
|
3
|
+
* rail rejects the action (`does not support execute rail`). Schema failures must not fall back
|
|
4
|
+
* to an empty queued execute-intent envelope.
|
|
5
|
+
*
|
|
6
|
+
* Keep in sync with `thirdfy-mcp` `src/lib/managedReadExecuteRail.ts`.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const EXECUTE_RAIL_UNSUPPORTED_FRAGMENT = 'does not support execute rail';
|
|
10
|
+
|
|
11
|
+
export function managedReadExecuteErrorText(data) {
|
|
12
|
+
return String(data?.error || data?.message || data?.code || data?.blockedReason || '').toLowerCase();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function shouldFallbackManagedReadToExecuteIntent({ isReadOnly, errorText } = {}) {
|
|
16
|
+
if (!isReadOnly) return false;
|
|
17
|
+
const err = String(errorText || '').toLowerCase();
|
|
18
|
+
if (err.includes('params_schema_invalid') || err.includes('invalid paramsschema') || err.includes('unknown key')) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return err.includes(EXECUTE_RAIL_UNSUPPORTED_FRAGMENT);
|
|
22
|
+
}
|
|
@@ -5,6 +5,35 @@ import { createCliError } from '../../core/envelope.mjs';
|
|
|
5
5
|
import { normalizeRunMode, normalizeManagedRunMode, normalizeHybridWalletMode } from '../../core/runMode.mjs';
|
|
6
6
|
import { assertEarnclawPolymarketWriteIdempotency } from './earnclawRuntimeWriteGate.mjs';
|
|
7
7
|
import { resolveTokenInForFunding } from '../../core/fundingTokenIn.mjs';
|
|
8
|
+
|
|
9
|
+
function isTruthyFlag(value) {
|
|
10
|
+
return value === true || String(value || '').trim().toLowerCase() === 'true';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function mergeConfirmWritesIntoParams(params, flags) {
|
|
14
|
+
const next = { ...(params && typeof params === 'object' ? params : {}) };
|
|
15
|
+
if (
|
|
16
|
+
isTruthyFlag(flags?.confirmWrites) ||
|
|
17
|
+
isTruthyFlag(flags?.confirm) ||
|
|
18
|
+
next.confirmWrites === true ||
|
|
19
|
+
next.confirm === true
|
|
20
|
+
) {
|
|
21
|
+
next.confirmWrites = true;
|
|
22
|
+
}
|
|
23
|
+
return next;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function resolveExecuteEstimatedAmountUsd(action, flags) {
|
|
27
|
+
const fromFlags = Number(flags?.estimatedAmountUsd);
|
|
28
|
+
if (Number.isFinite(fromFlags) && fromFlags > 0) return fromFlags;
|
|
29
|
+
const key = String(action || '')
|
|
30
|
+
.trim()
|
|
31
|
+
.toLowerCase()
|
|
32
|
+
.replace(/-/g, '_');
|
|
33
|
+
if (key === 'complete_avantis_onboarding') return 1;
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
8
37
|
export function createExecutionPayloads({ getPreparedParams, rawUnitsToDecimalString }) {
|
|
9
38
|
function buildBuildTxPayload(flags, resolvedAction) {
|
|
10
39
|
const runMode = String(flags.runMode || '').trim().toLowerCase() || 'self';
|
|
@@ -74,7 +103,7 @@ function resolveEffectiveUserDid(flags, options = {}) {
|
|
|
74
103
|
function buildManagedExecutePayload(flags, options) {
|
|
75
104
|
const runMode = String(options.runMode || flags.runMode || 'agent_wallet').trim().toLowerCase();
|
|
76
105
|
const params = getPreparedParams(flags);
|
|
77
|
-
const managedParams = { ...params };
|
|
106
|
+
const managedParams = mergeConfirmWritesIntoParams({ ...params }, flags);
|
|
78
107
|
if (flags.__swapInput?.unitSource === 'human' && flags.__swapInput.amountInHuman) {
|
|
79
108
|
delete managedParams.amountInRaw;
|
|
80
109
|
delete managedParams.amountInHuman;
|
|
@@ -119,7 +148,8 @@ function buildManagedExecutePayload(flags, options) {
|
|
|
119
148
|
'Managed wallet execution requires --user-did, --agent-key (solo did:wallet identity), THIRDFY_USER_DID, or a saved userDid from `thirdfy-agent login email`.'
|
|
120
149
|
);
|
|
121
150
|
}
|
|
122
|
-
|
|
151
|
+
const estimatedAmountUsd = resolveExecuteEstimatedAmountUsd(payload.action, flags);
|
|
152
|
+
if (estimatedAmountUsd != null) payload.estimatedAmountUsd = estimatedAmountUsd;
|
|
123
153
|
if (options.forceIdempotency) {
|
|
124
154
|
payload.executionIdempotencyKey = String(
|
|
125
155
|
flags.idempotencyKey || `cli:walletExecute:${payload.action}:${Date.now()}:${randomUUID()}`
|
|
@@ -140,11 +170,12 @@ function buildIntentPayload(flags, options) {
|
|
|
140
170
|
const payload = {
|
|
141
171
|
agentApiKey: resolveAgentApiKey(flags, runMode),
|
|
142
172
|
action: String(options.resolvedAction || requireFlag(flags, 'action', 'Missing --action')).trim(),
|
|
143
|
-
params: getPreparedParams(flags),
|
|
173
|
+
params: mergeConfirmWritesIntoParams(getPreparedParams(flags), flags),
|
|
144
174
|
};
|
|
145
175
|
if (flags.catalog) payload.catalog = String(flags.catalog).trim();
|
|
146
176
|
if (flags.chainId) payload.chainId = Number(flags.chainId);
|
|
147
|
-
|
|
177
|
+
const estimatedAmountUsd = resolveExecuteEstimatedAmountUsd(payload.action, flags);
|
|
178
|
+
if (estimatedAmountUsd != null) payload.estimatedAmountUsd = estimatedAmountUsd;
|
|
148
179
|
const intentRunMode = String(options.runMode || flags.runMode || '').trim().toLowerCase();
|
|
149
180
|
const userDid = resolveEffectiveUserDid(flags, {
|
|
150
181
|
runMode: intentRunMode,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { apiGet, apiPost } from '../../core/http.mjs';
|
|
13
13
|
import { withActionTimeout } from '../../core/actionTimeouts.mjs';
|
|
14
14
|
import { isReadOnlyResolvedAction } from '../../core/readOnlyActions.mjs';
|
|
15
|
+
import { shouldFallbackManagedReadToExecuteIntent } from './managedReadExecuteRail.mjs';
|
|
15
16
|
import { createRequire } from 'module';
|
|
16
17
|
|
|
17
18
|
const require = createRequire(import.meta.url);
|
|
@@ -85,9 +86,10 @@ function isReadOnlyAction(resolved) {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
function shouldFallbackAgentWalletToExecuteIntent(resolved, response) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
return shouldFallbackManagedReadToExecuteIntent({
|
|
90
|
+
isReadOnly: isReadOnlyAction(resolved),
|
|
91
|
+
errorText: String(response?.error || response?.message || response?.code || response?.blockedReason || ''),
|
|
92
|
+
});
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
// Managed /execute often returns provider payloads as JSON strings under data.result. Pack parsers
|