Fix Nacos skill marketplace latest label resolution
AgentScope-Java Version
main branch
Description
Background
When using the Builder Nacos marketplace, skill preview/install can fail while loading a skill version detail.
The previous implementation passed the label name LATEST directly as the version argument to getSkillVersionDetail(namespaceId, skillName, version). However, the Nacos skill version detail API expects the actual skill version value, not the label name.
This could produce a request equivalent to:
/nacos/v3/admin/ai/skills/version?skillName=<skillName>&namespaceId=<namespaceId>&version=LATEST
Nacos then returns an error similar to:
Skill version not found: <skillName>@LATEST
Purpose
This PR fixes Nacos-backed Builder marketplace preview/install by resolving the real skill version from the skill metadata labels before loading the skill version detail.
Changes Made
- Load skill metadata through the Nacos maintainer client.
- Resolve the actual skill version from the
LATESTlabel in the skill metadata. - Use the resolved version value when calling
getSkillVersionDetail(...). - Add validation so a clear error is raised if the
LATESTlabel cannot be resolved.
How to Test
- Start a Nacos server with Skill Registry support.
- Create or publish a Nacos skill with a
LATESTlabel pointing to an online skill version. - Add the Nacos marketplace in Builder.
- Preview the Nacos skill from Builder.
- Install the skill into an agent.
Expected result:
- Builder no longer requests skill details with
version=LATEST. - Builder resolves the actual skill version from Nacos skill metadata.
- Skill preview succeeds.
- Skill installation succeeds.
- The installed skill appears in the agent's skills list.
Local validation:
mvn -q -pl agentscope-examples/agents/agentscope-builder -am spotless:apply
mvn -q -pl agentscope-examples/agents/agentscope-builder -am -DskipTests compile
Checklist
Please check the following items before code is ready to be reviewed.
- [x] Code has been formatted with
mvn spotless:apply - [ ] All tests are passing (
mvn test) - [ ] Javadoc comments are complete and follow project conventions
- [ ] Related documentation has been updated (e.g. links, examples, etc.)
- [x] Code is ready for review
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:loudspeaker: Thoughts on this report? Let us know!