diff --git a/dify-agent/src/dify_agent/layers/drive/layer.py b/dify-agent/src/dify_agent/layers/drive/layer.py index 9e5f9c3091e..af5011b7b69 100644 --- a/dify-agent/src/dify_agent/layers/drive/layer.py +++ b/dify-agent/src/dify_agent/layers/drive/layer.py @@ -128,7 +128,7 @@ class DifyDriveLayer(PlainLayer[DifyDriveDeps, DifyDriveLayerConfig, EmptyRuntim continue local_path = Path(pulled_skill_path).parent loaded_skill_sections.append( - f"Path: {skill.path}\nLocal path: {local_path}\nName: {skill.name}\nSKILL.md:\n{body}" + f"Path: {skill.path}\nLocal path: {local_path}\nSKILL.md:\n{body}" ) if loaded_skill_sections: sections.append("Loaded mentioned skills:\n\n" + "\n\n".join(loaded_skill_sections)) @@ -158,7 +158,8 @@ class DifyDriveLayer(PlainLayer[DifyDriveDeps, DifyDriveLayerConfig, EmptyRuntim "Other available skills:\n" + "\n".join(other_skills) + "\n\nTo use one, pull it and read its SKILL.md in one command: " - '`cat "$(dify-agent drive pull --to /tmp/drive)/SKILL.md"`.' + '`skill_dir="$(dify-agent drive pull --to /tmp/drive)"; ' + 'printf "%s\\n" "$skill_dir"; cat "$skill_dir/SKILL.md"`.' ) sections.append(_AGENT_STUB_CLI_USAGE_PROMPT) return "\n\n".join(sections) diff --git a/dify-agent/tests/local/dify_agent/layers/drive/test_layer.py b/dify-agent/tests/local/dify_agent/layers/drive/test_layer.py index fe9cff05967..ead91a41f01 100644 --- a/dify-agent/tests/local/dify_agent/layers/drive/test_layer.py +++ b/dify-agent/tests/local/dify_agent/layers/drive/test_layer.py @@ -102,7 +102,10 @@ def test_drive_layer_exposes_agent_stub_cli_usage_suffix_prompt(tmp_path: Path) assert "Other available skills" in prompt assert "other-skill: Other Skill — Fallback catalog entry." in prompt assert "`dify-agent drive pull other-skill/`" not in prompt - assert '`cat "$(dify-agent drive pull --to /tmp/drive)/SKILL.md"`' in prompt + assert ( + '`skill_dir="$(dify-agent drive pull --to /tmp/drive)"; ' + 'printf "%s\\n" "$skill_dir"; cat "$skill_dir/SKILL.md"`' + ) in prompt assert "dify-agent drive list [REMOTE_PREFIX]" in prompt assert "dify-agent drive pull [REMOTE ...] [--to LOCAL_DIR]" in prompt assert "--to ." in prompt @@ -152,6 +155,7 @@ async def test_on_context_create_loads_mentioned_targets_into_prompt( prompt = layer.build_prompt_context() assert "Loaded mentioned skills" in prompt assert f"Local path: {tmp_path / 'tender-analyzer'}" in prompt + assert "Name: Tender Analyzer" not in prompt assert "# Tender Analyzer\nUse carefully." in prompt assert f"files/report.pdf -> {tmp_path / 'files' / 'report.pdf'}" in prompt assert "Other available skills" not in prompt @@ -193,6 +197,7 @@ async def test_on_context_resume_loads_mentioned_targets_into_prompt( prompt = layer.build_prompt_context() assert "Loaded mentioned skills" in prompt assert f"Local path: {tmp_path / 'tender-analyzer'}" in prompt + assert "Name: Tender Analyzer" not in prompt assert "# Tender Analyzer\nUse carefully." in prompt assert f"files/report.pdf -> {tmp_path / 'files' / 'report.pdf'}" in prompt assert "Other available skills" not in prompt