Skip to content

chore: standardise agent terminology to agentMint / agentWallet#122

Open
tonyboylehub wants to merge 1 commit intomainfrom
standardise-agent-terminology
Open

chore: standardise agent terminology to agentMint / agentWallet#122
tonyboylehub wants to merge 1 commit intomainfrom
standardise-agent-terminology

Conversation

@tonyboylehub
Copy link
Copy Markdown
Contributor

Summary

Aligns all agent command inputs and outputs with the canonical names agreed with the client SDK: agentMint for the Core asset address (on-chain identity) and agentWallet for the Asset Signer PDA (operational wallet).

Previously these concepts had inconsistent names across commands — asset, agentAsset, wallet, signerPda were all used interchangeably. This PR makes them uniform.

Changes

Command What changed
agents fetch arg + output: assetagentMint, walletagentWallet
agents register arg + output: assetagentMint (both API and on-chain paths)
agents set-agent-token arg + output: asset / agentAssetagentMint
agents executive delegate arg + output: asset / agentAssetagentMint
agents executive revoke arg + output: asset / agentAssetagentMint
genesis launch create agentMint now included in JSON output when agent mode is active
config wallets add new --agent <agentMint> flag; outputs agentMint / agentWallet / type: 'agent'; existing --asset path unchanged
Context.ts type: 'agent' added to WalletEntry union, treated identically to asset-signer at runtime

Notes

  • core asset execute info is intentionally unchanged — it is a generic Core asset command, not agent-specific, so asset / signerPda remain appropriate there.
  • config wallets add --asset is also unchanged. The new --agent flag is an agent-specific path that uses the new naming; the generic asset-signer path keeps its existing field names.
  • No breaking changes to runtime behaviour — only naming of CLI args and JSON output fields.

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
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 20, 2026

Summary by CodeRabbit

  • New Features

    • Agent wallet support now available in wallet management, allowing secure configuration of agent signers with automatic owner wallet verification
  • Refactor

    • Agent command interfaces standardized with consistent parameter naming; configuration system extended to support agent wallet types with proper type detection

Walkthrough

Renamed the CLI parameter from asset to agentMint across multiple agent commands, added agent wallet support in wallet configuration, extended context to handle agent wallet entries, and updated the genesis launch return object to include agentMint when an agent is present.

Changes

Cohort / File(s) Summary
Agent command parameter renaming
src/commands/agents/executive/delegate.ts, src/commands/agents/executive/revoke.ts, src/commands/agents/fetch.ts, src/commands/agents/register.ts, src/commands/agents/set-agent-token.ts
Updated CLI argument from asset to agentMint across examples, usage strings, and argument declarations. Modified run() methods to derive public keys from args.agentMint and updated returned object fields to use agentMint instead of agentAsset. This change affects command interface, logging output, and response payloads consistently across all five commands.
Agent wallet configuration
src/commands/config/wallets/add.ts
Added new --agent flag to support agent wallet creation alongside the existing --asset flag. New control flow fetches on-chain asset for provided agent mint via UMI, derives asset signer PDA, validates owner wallet exists in config, prevents duplicates, and persists agent wallet entry with type: 'agent' containing asset, address, and optional payer fields.
Wallet type system extension
src/lib/Context.ts
Extended WalletEntry union with new { type: 'agent'; asset: string; payer?: string } variant. Updated active-wallet detection to treat type: 'agent' same as type: 'asset-signer' for asset-signer mode, and adjusted owner-wallet resolution to exclude both 'asset-signer' and 'agent' wallet types.
Genesis launch integration
src/commands/genesis/launch/create.ts
Conditionally includes agentMint in sendLaunch return object when launchInput.agent is present, converting launchInput.agent.mint to string format.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: standardizing agent terminology from inconsistent names to agentMint and agentWallet across multiple commands and outputs.
Description check ✅ Passed The description is directly related to the changeset, providing a clear summary of terminology standardization, listing affected commands, and explaining the rationale and scope of changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch standardise-agent-terminology

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟡 Minor

Stale <asset> reference in description block.

The inline workflow example still uses <asset>, inconsistent with the renamed positional arg agentMint (and the examples array on line 44 which you did update). Users reading --help will 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 | 🟡 Minor

Owner-wallet filter in the --asset branch should also exclude type === 'agent'.

The new --agent branch at line 78 correctly excludes both 'asset-signer' and 'agent' when resolving the owner wallet, but this pre-existing --asset branch filter was not updated. An 'agent' wallet whose PDA happens to equal ownerAddress (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 | 🔵 Trivial

Consider extracting the shared asset-signer/agent flow.

The --agent (lines 64-122) and --asset (lines 124-184) branches are structurally identical: derive findAssetSignerPda, build a UMI + fetchAsset, resolve owner, check for duplicate PDA, persist the entry, log, and return. Only the type discriminator, log labels, and two return-field names differ. Extracting a helper like addAssetSignerLikeWallet({ 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 | 🟠 Major

Agent variant not handled consistently in wallet display and selection commands.

The new 'agent' variant shares the same shape (asset, payer) as 'asset-signer', and createContext correctly treats them identically. However, three sibling commands are incomplete:

  • src/commands/config/wallets/list.ts (lines 25, 34): isActive check and asset column 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6bd7a33 and 96f14c8.

📒 Files selected for processing (8)
  • src/commands/agents/executive/delegate.ts
  • src/commands/agents/executive/revoke.ts
  • src/commands/agents/fetch.ts
  • src/commands/agents/register.ts
  • src/commands/agents/set-agent-token.ts
  • src/commands/config/wallets/add.ts
  • src/commands/genesis/launch/create.ts
  • src/lib/Context.ts

Comment on lines 26 to 32
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',
}),
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
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.

tonyboylehub added a commit to metaplex-foundation/developer-hub that referenced this pull request Apr 20, 2026
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`
tonyboylehub added a commit to metaplex-foundation/developer-hub that referenced this pull request Apr 20, 2026
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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant