Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,8 @@ public void uploadSkillFiles() {
continue;
}

Path skillDir = targetDir.resolve(skillId);
// Upload synthesized skills under the package directory, not the source-qualified id.
Path skillDir = targetDir.resolve(skill.getName());

for (String resourcePath : resourcePaths) {
if (!filter.accept(resourcePath)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import io.agentscope.core.tool.Toolkit;
import io.agentscope.core.tool.mcp.McpClientWrapper;
import io.modelcontextprotocol.spec.McpSchema;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -325,6 +327,28 @@ void testSetSkillActiveWithoutTools() {
skillBox.isSkillActive(purePromptSkill.getSkillId()),
"Logical state should be inactive");
}

@Test
@DisplayName("Should upload skill resources under the package directory name")
void testUploadSkillFilesUsesSkillNameDirectory() throws Exception {
AgentSkill skill =
new AgentSkill(
"resource_skill",
"Skill with resources",
"# Resource Skill",
Map.of("SOUL.md", "soul content"),
"classpath:/skills/resource_skill");
skillBox.registerSkill(skill);

assertDoesNotThrow(() -> skillBox.uploadSkillFiles());

Path uploadDir = skillBox.getUploadDir();
assertNotNull(uploadDir, "Upload directory should be initialized");

Path expectedResource = uploadDir.resolve(skill.getName()).resolve("SOUL.md");
assertTrue(Files.exists(expectedResource), "Resource should be uploaded by skill name");
assertEquals("soul content", Files.readString(expectedResource));
}
}

private AgentTool createTestTool(String name) {
Expand Down
Loading