chore: standardise agent terminology to agentMint / agentWallet#122
chore: standardise agent terminology to agentMint / agentWallet#122tonyboylehub wants to merge 1 commit intomainfrom
Conversation
Aligns all agent command inputs and outputs with the canonical names agreed with the client SDK: agentMint for the Core asset address and agentWallet for the Asset Signer PDA. - agents fetch: arg asset → agentMint; output asset → agentMint, wallet → agentWallet - agents register: arg asset → agentMint; output asset → agentMint (both API and on-chain paths) - agents set-agent-token: arg asset → agentMint; output agentAsset → agentMint - agents executive delegate: arg asset → agentMint; output agentAsset → agentMint - agents executive revoke: arg asset → agentMint; output agentAsset → agentMint - genesis launch create: add agentMint to JSON output when in agent mode - config wallets add: add --agent flag with agentMint/agentWallet output fields and type:'agent'; --asset path unchanged - Context.ts: add type:'agent' to WalletEntry union; treat it the same as 'asset-signer' in resolveActiveWallet
Summary by CodeRabbit
WalkthroughRenamed the CLI parameter from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
src/commands/agents/register.ts (1)
26-38:⚠️ Potential issue | 🟡 MinorStale
<asset>reference in description block.The inline workflow example still uses
<asset>, inconsistent with the renamed positional argagentMint(and the examples array on line 44 which you did update). Users reading--helpwill see both names.📝 Proposed fix
- 2. Direct IX with existing asset: - mplx agents register <asset> --use-ix --from-file "./agent-doc.json" + 2. Direct IX with existing agent mint: + mplx agents register <agentMint> --use-ix --from-file "./agent-doc.json"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/agents/register.ts` around lines 26 - 38, Update the stale positional argument name in the CLI help/wizard comment: replace the old "<asset>" placeholder with the new positional name "agentMint" in the workflows block inside src/commands/agents/register.ts so the inline example that currently reads "mplx agents register <asset> --use-ix --from-file \"./agent-doc.json\"" matches the updated examples and the actual positional arg (agentMint).src/commands/config/wallets/add.ts (2)
138-141:⚠️ Potential issue | 🟡 MinorOwner-wallet filter in the
--assetbranch should also excludetype === 'agent'.The new
--agentbranch at line 78 correctly excludes both'asset-signer'and'agent'when resolving the owner wallet, but this pre-existing--assetbranch filter was not updated. An'agent'wallet whose PDA happens to equalownerAddress(or a misconfigured entry) could be selected as the payer, whereas agent/asset-signer wallets are PDAs and cannot sign as the owner. Keep both filters aligned.🔧 Proposed fix
const ownerWallet = config.wallets.find( - w => w.address === ownerAddress && w.type !== 'asset-signer' + w => w.address === ownerAddress && w.type !== 'asset-signer' && w.type !== 'agent' )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/config/wallets/add.ts` around lines 138 - 141, In the --asset branch of src/commands/config/wallets/add.ts update the ownerWallet lookup so it excludes agent wallets as well as asset-signers: change the filter on config.wallets used in the ownerWallet const (the expression w => w.address === ownerAddress && w.type !== 'asset-signer') to also check w.type !== 'agent' so agent PDAs cannot be selected as the owner/payer.
64-184: 🧹 Nitpick | 🔵 TrivialConsider extracting the shared asset-signer/agent flow.
The
--agent(lines 64-122) and--asset(lines 124-184) branches are structurally identical: derivefindAssetSignerPda, build a UMI +fetchAsset, resolve owner, check for duplicate PDA, persist the entry, log, and return. Only thetypediscriminator, log labels, and two return-field names differ. Extracting a helper likeaddAssetSignerLikeWallet({ type, mint, flags, config, configPath })would eliminate drift (e.g., the owner-filter bug flagged above) and make future changes safer.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/config/wallets/add.ts` around lines 64 - 184, Both the --agent and --asset branches duplicate the same flow (derive PDA via findAssetSignerPda, create UMI with consolidateConfigs/createUmi + mplCore and fetchAsset, resolve owner, duplicate-PDA check, persist via writeJsonSync, log and return) so extract a shared helper (e.g., addAssetSignerLikeWallet) that accepts parameters to vary the few differences (type: 'agent'|'asset-signer', mint/address input, log labels, and return-field mapping). Move repeated steps into that helper: deriving pda (findAssetSignerPda), creating umi (consolidateConfigs + createUmi().use(mplCore())), fetching asset (fetchAsset), resolving owner and finding ownerWallet in config.wallets, duplicate PDA check, pushing to config.wallets and persisting (ensureDirectoryExists + writeJsonSync), and returning the structured result; then replace both branches to call this helper with the appropriate type, mint flag, and label/return-field mappings to eliminate drift (address the owner-filter bug by reusing the same owner-wallet lookup logic in the helper).src/lib/Context.ts (1)
33-40:⚠️ Potential issue | 🟠 MajorAgent variant not handled consistently in wallet display and selection commands.
The new
'agent'variant shares the same shape (asset,payer) as'asset-signer', andcreateContextcorrectly treats them identically. However, three sibling commands are incomplete:
src/commands/config/wallets/list.ts(lines 25, 34):isActivecheck andassetcolumn display only for'asset-signer'; agent wallets will show incorrect active status and missing asset info.src/commands/config/wallets/set.ts(lines 53, 65, 81): Type label and activeWallet assignment only for'asset-signer'; agent wallets will render without "(agent)" label and won't be settable as active.src/commands/config/wallets/add.ts(line 140): Owner wallet filter excludes only'asset-signer', not'agent'; agent wallets could be incorrectly selected as owners (note: line 78 in the same file correctly filters both).Update all five locations to handle
'agent'alongside'asset-signer'.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/Context.ts` around lines 33 - 40, The WalletEntry variant 'agent' was added but the UI/commands still only treat 'asset-signer'; update all places that branch on wallet.type so they treat 'agent' the same as 'asset-signer' — specifically: in the code that computes isActive (the active-wallet check/predicate) and the asset column rendering, include wallet.type === 'agent' alongside 'asset-signer'; in the code that builds the type label and assigns activeWallet (the setter path that records the selected wallet as active), append the "(agent)" label and allow setting when type === 'agent'; and in the owner-wallet filter predicate (the function used when filtering owner/candidate wallets) include 'agent' in the allowed types the same way 'asset-signer' is currently handled. Refer to the WalletEntry type and the variables/functions named isActive, activeWallet (assignment), the type label construction, asset column rendering, and the owner wallet filter predicate to locate and change the branches.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/commands/config/wallets/add.ts`:
- Around line 26-32: The flags --asset and --agent are mutually exclusive but
the code currently lets the --agent branch win silently; add an explicit check
in the command's run function to detect when both flags are passed (flags.asset
&& flags.agent) and immediately return an error (or throw) with a clear message
asking the user to provide only one of the flags. Locate the run logic that
selects the agent branch (the existing check for flags.agent) and add this
validation before that branch so the conflict is caught early; reference the
flag names 'asset' and 'agent' and the 'run' method (or handler) when making the
change.
---
Outside diff comments:
In `@src/commands/agents/register.ts`:
- Around line 26-38: Update the stale positional argument name in the CLI
help/wizard comment: replace the old "<asset>" placeholder with the new
positional name "agentMint" in the workflows block inside
src/commands/agents/register.ts so the inline example that currently reads "mplx
agents register <asset> --use-ix --from-file \"./agent-doc.json\"" matches the
updated examples and the actual positional arg (agentMint).
In `@src/commands/config/wallets/add.ts`:
- Around line 138-141: In the --asset branch of
src/commands/config/wallets/add.ts update the ownerWallet lookup so it excludes
agent wallets as well as asset-signers: change the filter on config.wallets used
in the ownerWallet const (the expression w => w.address === ownerAddress &&
w.type !== 'asset-signer') to also check w.type !== 'agent' so agent PDAs cannot
be selected as the owner/payer.
- Around line 64-184: Both the --agent and --asset branches duplicate the same
flow (derive PDA via findAssetSignerPda, create UMI with
consolidateConfigs/createUmi + mplCore and fetchAsset, resolve owner,
duplicate-PDA check, persist via writeJsonSync, log and return) so extract a
shared helper (e.g., addAssetSignerLikeWallet) that accepts parameters to vary
the few differences (type: 'agent'|'asset-signer', mint/address input, log
labels, and return-field mapping). Move repeated steps into that helper:
deriving pda (findAssetSignerPda), creating umi (consolidateConfigs +
createUmi().use(mplCore())), fetching asset (fetchAsset), resolving owner and
finding ownerWallet in config.wallets, duplicate PDA check, pushing to
config.wallets and persisting (ensureDirectoryExists + writeJsonSync), and
returning the structured result; then replace both branches to call this helper
with the appropriate type, mint flag, and label/return-field mappings to
eliminate drift (address the owner-filter bug by reusing the same owner-wallet
lookup logic in the helper).
In `@src/lib/Context.ts`:
- Around line 33-40: The WalletEntry variant 'agent' was added but the
UI/commands still only treat 'asset-signer'; update all places that branch on
wallet.type so they treat 'agent' the same as 'asset-signer' — specifically: in
the code that computes isActive (the active-wallet check/predicate) and the
asset column rendering, include wallet.type === 'agent' alongside
'asset-signer'; in the code that builds the type label and assigns activeWallet
(the setter path that records the selected wallet as active), append the
"(agent)" label and allow setting when type === 'agent'; and in the owner-wallet
filter predicate (the function used when filtering owner/candidate wallets)
include 'agent' in the allowed types the same way 'asset-signer' is currently
handled. Refer to the WalletEntry type and the variables/functions named
isActive, activeWallet (assignment), the type label construction, asset column
rendering, and the owner wallet filter predicate to locate and change the
branches.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: f848a3bc-5dd2-4a0a-9bcf-ebd20f2b9ec8
📒 Files selected for processing (8)
src/commands/agents/executive/delegate.tssrc/commands/agents/executive/revoke.tssrc/commands/agents/fetch.tssrc/commands/agents/register.tssrc/commands/agents/set-agent-token.tssrc/commands/config/wallets/add.tssrc/commands/genesis/launch/create.tssrc/lib/Context.ts
| asset: Flags.string({ | ||
| description: 'Asset ID to create an asset-signer wallet from', | ||
| description: 'Core asset address to create an asset-signer wallet from', | ||
| }), | ||
| agent: Flags.string({ | ||
| description: 'Agent mint address (Core asset) to create an agent wallet from', | ||
| }), | ||
| } |
There was a problem hiding this comment.
Flags --asset and --agent should be mutually exclusive.
If a user passes both, the --agent branch (checked first on line 64) silently wins and --asset is ignored with no warning.
🔧 Proposed fix
static override flags = {
asset: Flags.string({
description: 'Core asset address to create an asset-signer wallet from',
+ exclusive: ['agent'],
}),
agent: Flags.string({
description: 'Agent mint address (Core asset) to create an agent wallet from',
+ exclusive: ['asset'],
}),
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| asset: Flags.string({ | |
| description: 'Asset ID to create an asset-signer wallet from', | |
| description: 'Core asset address to create an asset-signer wallet from', | |
| }), | |
| agent: Flags.string({ | |
| description: 'Agent mint address (Core asset) to create an agent wallet from', | |
| }), | |
| } | |
| asset: Flags.string({ | |
| description: 'Core asset address to create an asset-signer wallet from', | |
| exclusive: ['agent'], | |
| }), | |
| agent: Flags.string({ | |
| description: 'Agent mint address (Core asset) to create an agent wallet from', | |
| exclusive: ['asset'], | |
| }), |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/commands/config/wallets/add.ts` around lines 26 - 32, The flags --asset
and --agent are mutually exclusive but the code currently lets the --agent
branch win silently; add an explicit check in the command's run function to
detect when both flags are passed (flags.asset && flags.agent) and immediately
return an error (or throw) with a clear message asking the user to provide only
one of the flags. Locate the run logic that selects the agent branch (the
existing check for flags.agent) and add this validation before that branch so
the conflict is caught early; reference the flag names 'asset' and 'agent' and
the 'run' method (or handler) when making the change.
Updates all CLI reference pages (en, ja, zh, ko) to use the canonical agent terminology aligned with the client SDK and CLI changes in metaplex-foundation/cli#122. Changes across all locales: - agents fetch: arg/output `ASSET_ADDRESS` → `AGENT_MINT`; output `asset:` → `agentMint:`, `wallet:` → `agentWallet:` - agents register: arg `ASSET_ADDRESS` → `AGENT_MINT`; output `Asset:` → `Agent Mint:` - agents set-agent-token: arg `AGENT_ASSET` → `AGENT_MINT`; output `Agent Asset:` → `Agent Mint:`; wallet add command updated to use --agent flag - agents executive delegate/revoke: arg `AGENT_ASSET` → `AGENT_MINT`; output `Agent Asset:` → `Agent Mint:` - agents index: placeholder `AGENT_ASSET` → `AGENT_MINT` - genesis launch: placeholder `AGENT_CORE_ASSET_ADDRESS` / `ASSET_ADDRESS` → `AGENT_MINT`
Updates all CLI reference pages (en, ja, zh, ko) to use the canonical agent terminology aligned with the client SDK and CLI changes in metaplex-foundation/cli#122. Changes across all locales: - agents fetch: arg/output `ASSET_ADDRESS` → `AGENT_MINT`; output `asset:` → `agentMint:`, `wallet:` → `agentWallet:` - agents register: arg `ASSET_ADDRESS` → `AGENT_MINT`; output `Asset:` → `Agent Mint:` - agents set-agent-token: arg `AGENT_ASSET` → `AGENT_MINT`; output `Agent Asset:` → `Agent Mint:`; wallet add command updated to use --agent flag - agents executive delegate/revoke: arg `AGENT_ASSET` → `AGENT_MINT`; output `Agent Asset:` → `Agent Mint:` - agents index: placeholder `AGENT_ASSET` → `AGENT_MINT` - genesis launch: placeholder `AGENT_CORE_ASSET_ADDRESS` / `ASSET_ADDRESS` → `AGENT_MINT`
Summary
Aligns all agent command inputs and outputs with the canonical names agreed with the client SDK:
agentMintfor the Core asset address (on-chain identity) andagentWalletfor the Asset Signer PDA (operational wallet).Previously these concepts had inconsistent names across commands —
asset,agentAsset,wallet,signerPdawere all used interchangeably. This PR makes them uniform.Changes
agents fetchasset→agentMint,wallet→agentWalletagents registerasset→agentMint(both API and on-chain paths)agents set-agent-tokenasset/agentAsset→agentMintagents executive delegateasset/agentAsset→agentMintagents executive revokeasset/agentAsset→agentMintgenesis launch createagentMintnow included in JSON output when agent mode is activeconfig wallets add--agent <agentMint>flag; outputsagentMint/agentWallet/type: 'agent'; existing--assetpath unchangedContext.tstype: 'agent'added toWalletEntryunion, treated identically toasset-signerat runtimeNotes
core asset execute infois intentionally unchanged — it is a generic Core asset command, not agent-specific, soasset/signerPdaremain appropriate there.config wallets add --assetis also unchanged. The new--agentflag is an agent-specific path that uses the new naming; the generic asset-signer path keeps its existing field names.