dashscope 1.27.0__tar.gz → 1.27.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dashscope-1.27.0 → dashscope-1.27.2}/PKG-INFO +16 -1
- {dashscope-1.27.0 → dashscope-1.27.2}/README.md +15 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/__init__.py +1 -1
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/agent.py +76 -6
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/__init__.py +2 -6
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/constants.py +3 -2
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/dispatch.py +5 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/handlers_misc.py +123 -1
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/handlers_session.py +83 -20
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/mcp.py +29 -9
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/startup.py +7 -4
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/commands.py +9 -2
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/config.py +31 -1
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/eval/__init__.py +7 -5
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/hooks.py +5 -3
- dashscope-1.27.2/dashscope/acli/mcp_stdio.py +313 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/memory/directives_learning.py +47 -12
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/memory/experience.py +3 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/memory/skill_evolution.py +15 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/memory/trace.py +3 -3
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/platforms/base.py +5 -1
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/prompt_pipeline.py +22 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/providers/openai.py +9 -7
- dashscope-1.27.2/dashscope/acli/sandbox.py +181 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/session.py +223 -0
- dashscope-1.27.2/dashscope/acli/session_events.py +200 -0
- dashscope-1.27.2/dashscope/acli/tools/checkpoint.py +167 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/tools/filesystem.py +10 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/tools/shell.py +98 -6
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/ui/tui.py +294 -41
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/resources/agents.py +8 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/resources/files.py +88 -2
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/resources/sessions.py +4 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/types/__init__.py +2 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/types/models.py +41 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/types/params.py +23 -1
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/api_entities/api_request_factory.py +99 -72
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/app/application.py +105 -52
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/asr/recognition.py +88 -3
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/asr/translation_recognizer.py +96 -4
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/http_tts/http_speech_synthesizer.py +9 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/__init__.py +3 -1
- dashscope-1.27.2/dashscope/cli/auth.py +116 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/common.py +54 -3
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/generation.py +48 -18
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/tokenizers/tokenization.py +31 -4
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/version.py +1 -1
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope.egg-info/PKG-INFO +16 -1
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope.egg-info/SOURCES.txt +5 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/setup.cfg +1 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/LICENSE +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/LICENSE.certifi +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/MANIFEST.in +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/NOTICE +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/__init__.pyi +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/__main__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/agents/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/agents/delegate.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/agents/subagent.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/agents/subagents.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/audit.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/capabilities/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/capabilities/local_memory.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/completer.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/examples.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/handlers_capability.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/handlers_config.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/handlers_device.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/handlers_key.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/handlers_profile.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/handlers_provider.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/handlers_setup.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/handlers_skill.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/multimodal.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/repl.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/runners.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/cli/streaming.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/compression.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/debuglog.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/deliverable.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/dev.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/basic-chat/.acli/config.toml +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/basic-chat/.acli/custom-extensions.toml +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/basic-chat/.acli/hooks.toml +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/basic-chat/.acli/skills/explain-code.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/basic-chat/.acli/skills/research-topic.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/basic-chat/.acli/skills/translate.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/basic-chat/.acli/skills/write-poem.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/basic-chat/.acli/system-prompt.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/basic-chat/README.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/config.toml +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/custom-extensions.toml +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/hooks.toml +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/agent.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/api-doc.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/cli.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/diagnose.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/error-code.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/explain-code.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/fine-tuning.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/multimodal.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/retrieval.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/sdk-example.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/speech.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/text-generation.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/translate.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/.acli/system-prompt.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/examples/dashscope-sdk-expert/README.md +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/executor.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/extensions.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/mcp_server.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/memory/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/memory/manager.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/memory/plan.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/memory/reflection.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/memory/tool_chains.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/permission.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/platforms/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/platforms/bailian/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/platforms/bailian/cli.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/platforms/bailian/mcp.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/platforms/local/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/platforms/local/history.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/platforms/local/memory.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/prompt.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/providers/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/providers/adapter.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/providers/anthropic.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/providers/base.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/providers/hardening.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/providers/profile.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/providers/tongyi.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/scheduler.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/sdk.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/skills/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/skills/base.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/skills/manager.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/skills/package.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/skills/store.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/tools/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/tools/browser.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/tools/camera.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/tools/evolution.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/tools/platform.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/tools/registry.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/tools/session.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/tools/skills.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/tools/web_search.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/ui/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/ui/camera.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/ui/embedded.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/ui/tts.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/ui/voice.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/clipboard.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/crypto.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/exceptions.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/ids.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/images.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/keywords.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/messages.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/paths.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/sanitizer.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/spinner.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/template.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/text.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/toml.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/acli/utils/validation.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/client.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/constants.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/exceptions.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/pagination.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/resources/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/resources/_helpers.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/resources/deployments.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/resources/environments.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/resources/session_events.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/resources/skills.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/resources/vaults.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/streaming.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/agentstudio/transport.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/aigc/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/aigc/chat_completion.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/aigc/code_generation.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/aigc/conversation.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/aigc/generation.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/aigc/image_generation.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/aigc/image_synthesis.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/aigc/multimodal_conversation.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/aigc/video_synthesis.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/api_entities/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/api_entities/aio_session.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/api_entities/aiohttp_request.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/api_entities/api_request_data.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/api_entities/base_request.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/api_entities/chat_completion_types.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/api_entities/dashscope_response.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/api_entities/encryption.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/api_entities/http_request.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/api_entities/websocket_request.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/app/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/app/application_response.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/assistants/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/assistants/assistant_types.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/assistants/assistants.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/assistants/files.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/asr/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/asr/asr_phrase_manager.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/asr/transcription.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/asr/vocabulary.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/http_tts/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/qwen_asr/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/qwen_asr/qwen_transcription.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/qwen_omni/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/qwen_omni/omni_realtime.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/qwen_tts/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/qwen_tts/speech_synthesizer.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/qwen_tts_realtime/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/qwen_tts_realtime/qwen_tts_realtime.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/tts/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/tts/speech_synthesizer.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/tts_v2/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/tts_v2/enrollment.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/audio/tts_v2/speech_synthesizer.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/__main__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/agentic_rl.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/application.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/code_generation.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/deployments.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/embeddings.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/files.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/fine_tunes.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/image_generation.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/image_synthesis.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/models.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/multimodal_conversation.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/multimodal_embedding.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/oss.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/rerank.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/speech_synthesis.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/tokenization.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/transcription.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/understanding.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/cli/video_synthesis.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/client/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/client/base_api.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/common/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/common/api_key.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/common/base_type.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/common/constants.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/common/env.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/common/error.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/common/logging.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/common/message_manager.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/common/utils.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/embeddings/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/embeddings/batch_text_embedding.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/embeddings/batch_text_embedding_response.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/embeddings/multimodal_embedding.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/embeddings/text_embedding.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/files.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/agentic_rl.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/customize_types.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/deployments.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/finetunes.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/common/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/common/constants.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/common/errors.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/common/log.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/common/model.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/common/model_types.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/common/utils.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/data/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/data/base_data_model.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/data/group_reward_input.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/data/group_reward_output.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/data/reward_input.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/data/reward_output.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/data/rollout_input.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/data/rollout_output.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/demo/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/demo/group_reward_processor_demo.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/demo/reward_processor_demo.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/demo/rollout_processor_demo.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/func_decorator.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/func_manager.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/observability/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/observability/genai/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/observability/genai/_core.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/observability/genai/llm_dashscope.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/observability/genai/llm_openai.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/observability/genai/llm_span.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/observability/genai/messages.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/observability/genai/tools.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/observability/processor_span.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/observability/tracing.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/parser/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/parser/base_parser.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/parser/group_reward_parser.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/parser/reward_parser.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/parser/rollout_parser.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/processor/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/processor/abstract_group_reward_processor.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/processor/abstract_processor.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/processor/abstract_reward_processor.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/processor/abstract_rollout_processor.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/server/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/finetune/reinforcement/component/server/server.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/io/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/io/input_output.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/model.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/models.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/multimodal/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/multimodal/dialog_state.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/multimodal/multimodal_constants.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/multimodal/multimodal_dialog.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/multimodal/multimodal_request_params.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/multimodal/tingwu/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/multimodal/tingwu/tingwu.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/multimodal/tingwu/tingwu_realtime.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/nlp/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/nlp/understanding.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/protocol/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/protocol/websocket.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/py.typed +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/rerank/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/rerank/text_rerank.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/resources/qwen.tiktoken +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/threads/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/threads/messages/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/threads/messages/files.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/threads/messages/messages.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/threads/runs/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/threads/runs/runs.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/threads/runs/steps.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/threads/thread_types.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/threads/threads.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/tokenizers/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/tokenizers/qwen_tokenizer.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/tokenizers/tokenizer.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/tokenizers/tokenizer_base.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/utils/__init__.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/utils/message_utils.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/utils/oss_utils.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope/utils/param_utils.py +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope.egg-info/dependency_links.txt +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope.egg-info/entry_points.txt +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope.egg-info/not-zip-safe +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope.egg-info/requires.txt +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/dashscope.egg-info/top_level.txt +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/requirements.txt +0 -0
- {dashscope-1.27.0 → dashscope-1.27.2}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dashscope
|
|
3
|
-
Version: 1.27.
|
|
3
|
+
Version: 1.27.2
|
|
4
4
|
Summary: dashscope client sdk library
|
|
5
5
|
Home-page: https://dashscope.aliyun.com/
|
|
6
6
|
Author: Alibaba Cloud
|
|
@@ -176,6 +176,21 @@ The SDK ships with an interactive AI assistant, **DashScope SDK Expert**, built
|
|
|
176
176
|
|
|
177
177
|
For the latest model list, visit [Bailian Model Plaza](https://bailian.console.aliyun.com/).
|
|
178
178
|
|
|
179
|
+
## Shell Completion
|
|
180
|
+
|
|
181
|
+
Run the appropriate command once, then restart your shell (or re-source your config file):
|
|
182
|
+
|
|
183
|
+
| Shell | Install command |
|
|
184
|
+
|-------|-----------------|
|
|
185
|
+
| **bash** | `dashscope --install-completion bash` |
|
|
186
|
+
| **zsh** | `dashscope --install-completion zsh` |
|
|
187
|
+
| **fish** | `dashscope --install-completion fish` |
|
|
188
|
+
|
|
189
|
+
To preview the completion script without installing:
|
|
190
|
+
```shell
|
|
191
|
+
dashscope --show-completion bash
|
|
192
|
+
```
|
|
193
|
+
|
|
179
194
|
## Logging
|
|
180
195
|
To output Dashscope logs, you need to configure the logger.
|
|
181
196
|
```shell
|
|
@@ -107,6 +107,21 @@ The SDK ships with an interactive AI assistant, **DashScope SDK Expert**, built
|
|
|
107
107
|
|
|
108
108
|
For the latest model list, visit [Bailian Model Plaza](https://bailian.console.aliyun.com/).
|
|
109
109
|
|
|
110
|
+
## Shell Completion
|
|
111
|
+
|
|
112
|
+
Run the appropriate command once, then restart your shell (or re-source your config file):
|
|
113
|
+
|
|
114
|
+
| Shell | Install command |
|
|
115
|
+
|-------|-----------------|
|
|
116
|
+
| **bash** | `dashscope --install-completion bash` |
|
|
117
|
+
| **zsh** | `dashscope --install-completion zsh` |
|
|
118
|
+
| **fish** | `dashscope --install-completion fish` |
|
|
119
|
+
|
|
120
|
+
To preview the completion script without installing:
|
|
121
|
+
```shell
|
|
122
|
+
dashscope --show-completion bash
|
|
123
|
+
```
|
|
124
|
+
|
|
110
125
|
## Logging
|
|
111
126
|
To output Dashscope logs, you need to configure the logger.
|
|
112
127
|
```shell
|
|
@@ -235,9 +235,32 @@ class Agent:
|
|
|
235
235
|
self.messages = []
|
|
236
236
|
|
|
237
237
|
def load_session(self) -> int:
|
|
238
|
-
"""Restore self.messages
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
"""Restore self.messages. Returns the number of messages loaded
|
|
239
|
+
(0 if nothing could be restored).
|
|
240
|
+
|
|
241
|
+
The per-topic event stream is the source of truth: the latest
|
|
242
|
+
``messages/snapshot`` wins when present (crash recovery via
|
|
243
|
+
append-only replay; torn trailing lines are skipped). The
|
|
244
|
+
``history.json`` file remains as the compat fallback for
|
|
245
|
+
sessions written before snapshots existed.
|
|
246
|
+
"""
|
|
247
|
+
if not self.session_path:
|
|
248
|
+
return 0
|
|
249
|
+
try:
|
|
250
|
+
from dashscope.acli.session_events import (
|
|
251
|
+
EVENTS_FILENAME,
|
|
252
|
+
SessionEventLog,
|
|
253
|
+
latest_snapshot_messages,
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
log = SessionEventLog(self.session_path.parent / EVENTS_FILENAME)
|
|
257
|
+
resumed = latest_snapshot_messages(log.read_raw())
|
|
258
|
+
if resumed:
|
|
259
|
+
self.messages = resumed
|
|
260
|
+
return len(resumed)
|
|
261
|
+
except Exception:
|
|
262
|
+
pass
|
|
263
|
+
if not self.session_path.exists():
|
|
241
264
|
return 0
|
|
242
265
|
try:
|
|
243
266
|
data = json.loads(self.session_path.read_text())
|
|
@@ -326,11 +349,25 @@ class Agent:
|
|
|
326
349
|
experience_tracker=self.experience_tracker,
|
|
327
350
|
disabled_caps_provider=self.disabled_caps_provider,
|
|
328
351
|
directives_provider=self.directives_provider,
|
|
352
|
+
scene_provider=self._scene_section,
|
|
329
353
|
current_turn_tools=self._current_turn_tools,
|
|
330
354
|
connected_mcp_services=self._connected_mcp_services,
|
|
331
355
|
)
|
|
332
356
|
return self._prompt_pipeline.render(ctx)
|
|
333
357
|
|
|
358
|
+
def _scene_section(self) -> str:
|
|
359
|
+
"""Scene memory of the current session topic (best-effort).
|
|
360
|
+
|
|
361
|
+
Subagents and SDK callers may run without a session manager;
|
|
362
|
+
any failure simply yields no scene section.
|
|
363
|
+
"""
|
|
364
|
+
try:
|
|
365
|
+
from dashscope.acli.session import get_session_manager
|
|
366
|
+
|
|
367
|
+
return get_session_manager().get_scene()
|
|
368
|
+
except Exception:
|
|
369
|
+
return ""
|
|
370
|
+
|
|
334
371
|
def _reflection_section(self) -> str:
|
|
335
372
|
"""Inject reflection hints when repeated failures detected."""
|
|
336
373
|
tracker = self.memory_manager.session.reflection
|
|
@@ -524,9 +561,9 @@ class Agent:
|
|
|
524
561
|
async for chunk in self.provider.chat_stream(
|
|
525
562
|
normalize_for_model(messages_with_system, self.model_name),
|
|
526
563
|
tools_schema,
|
|
527
|
-
response_format=
|
|
528
|
-
|
|
529
|
-
|
|
564
|
+
response_format=(
|
|
565
|
+
{"type": "json_object"} if self.json_mode else None
|
|
566
|
+
),
|
|
530
567
|
):
|
|
531
568
|
if chunk.delta_content:
|
|
532
569
|
full_content += chunk.delta_content
|
|
@@ -765,6 +802,39 @@ class Agent:
|
|
|
765
802
|
),
|
|
766
803
|
)
|
|
767
804
|
|
|
805
|
+
# Record the completed turn as events (session-as-event-log
|
|
806
|
+
# direction) BEFORE persisting history.json: the event stream is
|
|
807
|
+
# the source of truth, so it must never be older than the
|
|
808
|
+
# fallback store if we crash between the two writes. Best-effort:
|
|
809
|
+
# subagents/SDK callers may run without a session manager, and
|
|
810
|
+
# event recording must never break the loop.
|
|
811
|
+
try:
|
|
812
|
+
from dashscope.acli.session import get_session_manager
|
|
813
|
+
|
|
814
|
+
turn_topic = (
|
|
815
|
+
self.session_path.parent.name if self.session_path else None
|
|
816
|
+
)
|
|
817
|
+
get_session_manager().record_turn_event(
|
|
818
|
+
user_text=text_of(user_input),
|
|
819
|
+
assistant_text=last_content,
|
|
820
|
+
tools_used=self._current_turn_tools,
|
|
821
|
+
outcome=(
|
|
822
|
+
_classify_outcome(
|
|
823
|
+
self._turn_tool_successes,
|
|
824
|
+
self._turn_tool_failures,
|
|
825
|
+
)
|
|
826
|
+
if self._current_turn_tools
|
|
827
|
+
else ""
|
|
828
|
+
),
|
|
829
|
+
topic=turn_topic,
|
|
830
|
+
)
|
|
831
|
+
get_session_manager().record_messages_snapshot(
|
|
832
|
+
self.messages,
|
|
833
|
+
topic=turn_topic,
|
|
834
|
+
)
|
|
835
|
+
except Exception:
|
|
836
|
+
pass
|
|
837
|
+
|
|
768
838
|
# Persist session before memory write so a memory exception can't
|
|
769
839
|
# cost us the conversation.
|
|
770
840
|
self.save_session()
|
|
@@ -52,9 +52,7 @@ from dashscope.acli.cli.dispatch import ( # noqa: F401,E402
|
|
|
52
52
|
_handle_slash_command,
|
|
53
53
|
dispatch_async_command,
|
|
54
54
|
)
|
|
55
|
-
from dashscope.acli.cli.examples import
|
|
56
|
-
_handle_example_command,
|
|
57
|
-
)
|
|
55
|
+
from dashscope.acli.cli.examples import _handle_example_command # noqa: E402
|
|
58
56
|
from dashscope.acli.cli.handlers_capability import ( # noqa: F401,E402
|
|
59
57
|
_cap_enabled,
|
|
60
58
|
sync_extensions_into_catalog,
|
|
@@ -62,9 +60,7 @@ from dashscope.acli.cli.handlers_capability import ( # noqa: F401,E402
|
|
|
62
60
|
from dashscope.acli.cli.handlers_misc import ( # noqa: F401,E402
|
|
63
61
|
_handle_report_command,
|
|
64
62
|
)
|
|
65
|
-
from dashscope.acli.cli.handlers_setup import
|
|
66
|
-
_handle_setup,
|
|
67
|
-
)
|
|
63
|
+
from dashscope.acli.cli.handlers_setup import _handle_setup # noqa: F401,E402
|
|
68
64
|
|
|
69
65
|
# Import MCP management from submodule
|
|
70
66
|
from dashscope.acli.cli.mcp import ( # noqa: F401,E402
|
|
@@ -186,6 +186,7 @@ _TOP_LEVEL_COMMANDS = [
|
|
|
186
186
|
"/report",
|
|
187
187
|
"/feedback",
|
|
188
188
|
"/history",
|
|
189
|
+
"/undo",
|
|
189
190
|
"/json",
|
|
190
191
|
"/save",
|
|
191
192
|
"/privacy",
|
|
@@ -224,11 +225,11 @@ _SUBCOMMANDS: dict[str, list[str]] = {
|
|
|
224
225
|
"/rule": ["list", "add", "remove", "edit", "clear"],
|
|
225
226
|
"/profile": ["list", "search", "add", "remove", "clear"],
|
|
226
227
|
"/memory": ["list", "search", "remove", "clear"],
|
|
227
|
-
"/session": ["new", "list", "switch", "rename", "remove"],
|
|
228
|
+
"/session": ["new", "list", "switch", "rename", "fork", "remove"],
|
|
228
229
|
"/mcp": ["list", "add", "remove"],
|
|
229
230
|
"/cron": ["add", "list", "remove", "pause", "resume"],
|
|
230
231
|
"/feedback": ["good", "bad"],
|
|
231
|
-
"/history": ["stats", "list", "export", "clear"],
|
|
232
|
+
"/history": ["stats", "list", "search", "export", "clear"],
|
|
232
233
|
"/json": ["on", "off"],
|
|
233
234
|
"/privacy": ["on", "off", "status"],
|
|
234
235
|
"/audit": ["recent", "query", "clear"],
|
|
@@ -403,6 +403,11 @@ def _handle_slash_command(
|
|
|
403
403
|
elif cmd.startswith("/history"):
|
|
404
404
|
_handle_history_command(cmd)
|
|
405
405
|
return True
|
|
406
|
+
elif cmd == "/undo":
|
|
407
|
+
from dashscope.acli.tools.checkpoint import handle_undo_command
|
|
408
|
+
|
|
409
|
+
handle_undo_command()
|
|
410
|
+
return True
|
|
406
411
|
elif cmd.startswith("/privacy"):
|
|
407
412
|
_handle_privacy_command(cmd, config)
|
|
408
413
|
return True
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
"""Miscellaneous command handlers (trust, history, report)."""
|
|
3
3
|
# pylint: disable=protected-access,too-many-branches,too-many-statements
|
|
4
|
+
# pylint: disable=too-many-return-statements
|
|
4
5
|
|
|
5
6
|
from __future__ import annotations
|
|
6
7
|
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
7
10
|
from rich.console import Console
|
|
11
|
+
from rich.markup import escape
|
|
8
12
|
|
|
9
13
|
from dashscope.acli.agent import Agent
|
|
10
14
|
|
|
@@ -77,6 +81,86 @@ def _handle_trust_command(cmd: str, agent: Agent) -> None:
|
|
|
77
81
|
)
|
|
78
82
|
|
|
79
83
|
|
|
84
|
+
def _message_text(msg: dict[str, Any]) -> str:
|
|
85
|
+
"""Flatten a chat message's content into one-line plain text."""
|
|
86
|
+
content = msg.get("content", "")
|
|
87
|
+
if isinstance(content, list):
|
|
88
|
+
content = " ".join(
|
|
89
|
+
part.get("text", "") for part in content if isinstance(part, dict)
|
|
90
|
+
)
|
|
91
|
+
if not isinstance(content, str):
|
|
92
|
+
return ""
|
|
93
|
+
return " ".join(content.split())
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _search_snippet(text: str, idx: int, kw_len: int) -> str:
|
|
97
|
+
"""Build a short one-line snippet centered on a match position."""
|
|
98
|
+
start = max(0, idx - 20)
|
|
99
|
+
end = min(len(text), idx + kw_len + 40)
|
|
100
|
+
prefix = "..." if start > 0 else ""
|
|
101
|
+
suffix = "..." if end < len(text) else ""
|
|
102
|
+
return prefix + text[start:end] + suffix
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _highlight_keyword(text: str, keyword: str) -> str:
|
|
106
|
+
"""Wrap keyword occurrences in rich markup (case-insensitive)."""
|
|
107
|
+
lower_kw = keyword.lower()
|
|
108
|
+
if not lower_kw:
|
|
109
|
+
return escape(text)
|
|
110
|
+
lower_text = text.lower()
|
|
111
|
+
out: list[str] = []
|
|
112
|
+
pos = 0
|
|
113
|
+
while True:
|
|
114
|
+
idx = lower_text.find(lower_kw, pos)
|
|
115
|
+
if idx < 0:
|
|
116
|
+
out.append(escape(text[pos:]))
|
|
117
|
+
break
|
|
118
|
+
out.append(escape(text[pos:idx]))
|
|
119
|
+
out.append("[bold yellow]")
|
|
120
|
+
out.append(escape(text[idx : idx + len(keyword)]))
|
|
121
|
+
out.append("[/bold yellow]")
|
|
122
|
+
pos = idx + len(keyword)
|
|
123
|
+
return "".join(out)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _history_search_matches(
|
|
127
|
+
keyword: str,
|
|
128
|
+
limit: int = 20,
|
|
129
|
+
) -> list[dict[str, str]]:
|
|
130
|
+
"""Case-insensitive substring search across all session history.
|
|
131
|
+
|
|
132
|
+
Scans every stored session's messages and returns up to ``limit``
|
|
133
|
+
matches, each carrying the session topic, a timestamp, the message
|
|
134
|
+
role, and a one-line snippet with match context.
|
|
135
|
+
"""
|
|
136
|
+
from dashscope.acli.session import get_session_manager
|
|
137
|
+
|
|
138
|
+
needle = keyword.lower()
|
|
139
|
+
if not needle or limit <= 0:
|
|
140
|
+
return []
|
|
141
|
+
mgr = get_session_manager()
|
|
142
|
+
matches: list[dict[str, str]] = []
|
|
143
|
+
for meta in mgr.list_topics():
|
|
144
|
+
if len(matches) >= limit:
|
|
145
|
+
break
|
|
146
|
+
for msg in mgr.load_messages(meta.topic):
|
|
147
|
+
text = _message_text(msg)
|
|
148
|
+
idx = text.lower().find(needle) if text else -1
|
|
149
|
+
if idx < 0:
|
|
150
|
+
continue
|
|
151
|
+
matches.append(
|
|
152
|
+
{
|
|
153
|
+
"session": meta.topic,
|
|
154
|
+
"timestamp": meta.last_accessed or "",
|
|
155
|
+
"role": str(msg.get("role", "?")),
|
|
156
|
+
"snippet": _search_snippet(text, idx, len(needle)),
|
|
157
|
+
},
|
|
158
|
+
)
|
|
159
|
+
if len(matches) >= limit:
|
|
160
|
+
break
|
|
161
|
+
return matches
|
|
162
|
+
|
|
163
|
+
|
|
80
164
|
def _handle_history_command(cmd: str) -> None:
|
|
81
165
|
"""Manage conversation history."""
|
|
82
166
|
from dashscope.acli.platforms.local.history import (
|
|
@@ -107,6 +191,8 @@ def _handle_history_command(cmd: str) -> None:
|
|
|
107
191
|
"\n[dim]Usage:\n"
|
|
108
192
|
" /history stats — show stats\n"
|
|
109
193
|
" /history list [n] — list recent n\n"
|
|
194
|
+
" /history search <keyword> [limit] — full-text "
|
|
195
|
+
"search\n"
|
|
110
196
|
" /history export <file> [--format json|md|html] — export\n"
|
|
111
197
|
" /history clear — clear "
|
|
112
198
|
"history[/dim]",
|
|
@@ -147,6 +233,41 @@ def _handle_history_command(cmd: str) -> None:
|
|
|
147
233
|
)
|
|
148
234
|
return
|
|
149
235
|
|
|
236
|
+
if sub == "search":
|
|
237
|
+
if len(parts) < 3:
|
|
238
|
+
console.print(
|
|
239
|
+
"[dim]Usage: /history search <keyword> [limit][/dim]",
|
|
240
|
+
)
|
|
241
|
+
return
|
|
242
|
+
keyword = parts[2]
|
|
243
|
+
limit = 20
|
|
244
|
+
if len(parts) >= 4:
|
|
245
|
+
try:
|
|
246
|
+
limit = int(parts[3])
|
|
247
|
+
except ValueError:
|
|
248
|
+
limit = 0
|
|
249
|
+
if limit <= 0:
|
|
250
|
+
console.print(
|
|
251
|
+
"[red]limit must be a positive integer[/red]",
|
|
252
|
+
)
|
|
253
|
+
return
|
|
254
|
+
matches = _history_search_matches(keyword, limit=limit)
|
|
255
|
+
if not matches:
|
|
256
|
+
console.print(f"[dim]No matches for '{keyword}'[/dim]")
|
|
257
|
+
return
|
|
258
|
+
header = f"[bold]{len(matches)} match(es) for '{keyword}':[/bold]"
|
|
259
|
+
console.print(header)
|
|
260
|
+
for i, m in enumerate(matches, 1):
|
|
261
|
+
ts = m["timestamp"][:16]
|
|
262
|
+
head = (
|
|
263
|
+
f" {i}. [cyan]{m['session']}[/cyan] "
|
|
264
|
+
f"[dim]{ts}[/dim] [bold]{m['role']}[/bold]"
|
|
265
|
+
)
|
|
266
|
+
console.print(head)
|
|
267
|
+
snippet = _highlight_keyword(m["snippet"], keyword)
|
|
268
|
+
console.print(f" {snippet}")
|
|
269
|
+
return
|
|
270
|
+
|
|
150
271
|
if sub == "export" and len(parts) >= 3:
|
|
151
272
|
output_path = parts[2]
|
|
152
273
|
fmt = "html"
|
|
@@ -174,7 +295,8 @@ def _handle_history_command(cmd: str) -> None:
|
|
|
174
295
|
console.print(f"[green]✓ Cleared {count} history records[/green]")
|
|
175
296
|
return
|
|
176
297
|
|
|
177
|
-
|
|
298
|
+
usage = "[dim]Usage: /history [stats|list|search|export|clear][/dim]"
|
|
299
|
+
console.print(usage)
|
|
178
300
|
|
|
179
301
|
|
|
180
302
|
def _handle_report_command(agent: Agent) -> None:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
"""Session management command handlers."""
|
|
3
3
|
# pylint: disable=too-many-branches,too-many-statements,unused-argument
|
|
4
|
+
# pylint: disable=too-many-return-statements
|
|
4
5
|
|
|
5
6
|
from __future__ import annotations
|
|
6
7
|
|
|
@@ -8,6 +9,23 @@ from rich.console import Console
|
|
|
8
9
|
|
|
9
10
|
console = Console()
|
|
10
11
|
|
|
12
|
+
_SESSION_USAGE = (
|
|
13
|
+
"\n[dim]Usage:\n"
|
|
14
|
+
" /session — show current topic\n"
|
|
15
|
+
" /session new [name] — new session (default: default)\n"
|
|
16
|
+
" /session list — list all sessions\n"
|
|
17
|
+
" /session switch <n> — switch to a topic\n"
|
|
18
|
+
" /session rename <old> <new> — rename\n"
|
|
19
|
+
" /session fork <new> [src] — fork a session (default src: "
|
|
20
|
+
"current)\n"
|
|
21
|
+
" /session remove <n> — remove session "
|
|
22
|
+
"(default cannot be removed)\n"
|
|
23
|
+
" /session scene — show scene memory of the current topic\n"
|
|
24
|
+
" /session scene <text> — append a note to scene memory\n"
|
|
25
|
+
" /session scene set <text> — replace scene memory\n"
|
|
26
|
+
" /session scene clear — clear scene memory[/dim]"
|
|
27
|
+
)
|
|
28
|
+
|
|
11
29
|
|
|
12
30
|
def _handle_session_command(cmd: str, config, agent) -> None:
|
|
13
31
|
"""Handle /session commands for multi-topic session management."""
|
|
@@ -20,16 +38,7 @@ def _handle_session_command(cmd: str, config, agent) -> None:
|
|
|
20
38
|
# Show current topic
|
|
21
39
|
current = session_mgr.get_current_topic()
|
|
22
40
|
console.print(f"[bold]Current session[/bold]: {current}")
|
|
23
|
-
console.print(
|
|
24
|
-
"\n[dim]Usage:\n"
|
|
25
|
-
" /session — show current topic\n"
|
|
26
|
-
" /session new [name] — new session (default: default)\n"
|
|
27
|
-
" /session list — list all sessions\n"
|
|
28
|
-
" /session switch <n> — switch to a topic\n"
|
|
29
|
-
" /session rename <old> <new> — rename\n"
|
|
30
|
-
" /session remove <n> — remove session "
|
|
31
|
-
"(default cannot be removed)[/dim]",
|
|
32
|
-
)
|
|
41
|
+
console.print(_SESSION_USAGE)
|
|
33
42
|
return
|
|
34
43
|
|
|
35
44
|
subcmd = parts[1]
|
|
@@ -122,6 +131,35 @@ def _handle_session_command(cmd: str, config, agent) -> None:
|
|
|
122
131
|
f"or '{new_name}' already exists[/red]",
|
|
123
132
|
)
|
|
124
133
|
|
|
134
|
+
elif subcmd == "fork":
|
|
135
|
+
if len(parts) < 3:
|
|
136
|
+
console.print(
|
|
137
|
+
"[dim]Usage: /session fork <new> [src][/dim]",
|
|
138
|
+
)
|
|
139
|
+
return
|
|
140
|
+
fork_args = parts[2].split(maxsplit=1)
|
|
141
|
+
dst = fork_args[0]
|
|
142
|
+
src = (
|
|
143
|
+
fork_args[1]
|
|
144
|
+
if len(fork_args) > 1
|
|
145
|
+
else (session_mgr.get_current_topic())
|
|
146
|
+
)
|
|
147
|
+
# Flush the live conversation when forking the active topic so
|
|
148
|
+
# the fork carries the latest messages.
|
|
149
|
+
if src == session_mgr.get_current_topic():
|
|
150
|
+
if agent.session_path and agent.messages:
|
|
151
|
+
agent.save_session()
|
|
152
|
+
if session_mgr.fork_topic(src, dst):
|
|
153
|
+
console.print(
|
|
154
|
+
f"[green]Forked session: {src} → {dst}[/green]\n"
|
|
155
|
+
f" [dim]Switch with: /session switch {dst}[/dim]",
|
|
156
|
+
)
|
|
157
|
+
else:
|
|
158
|
+
console.print(
|
|
159
|
+
f"[red]Fork failed: '{src}' does not exist "
|
|
160
|
+
f"or '{dst}' already exists[/red]",
|
|
161
|
+
)
|
|
162
|
+
|
|
125
163
|
elif subcmd == "remove":
|
|
126
164
|
topic = parts[2] if len(parts) > 2 else ""
|
|
127
165
|
if not topic:
|
|
@@ -137,14 +175,39 @@ def _handle_session_command(cmd: str, config, agent) -> None:
|
|
|
137
175
|
else:
|
|
138
176
|
console.print(f"[red]Session '{topic}' does not exist[/red]")
|
|
139
177
|
|
|
178
|
+
elif subcmd == "scene":
|
|
179
|
+
topic = session_mgr.get_current_topic()
|
|
180
|
+
rest = parts[2].strip() if len(parts) > 2 else ""
|
|
181
|
+
if not rest:
|
|
182
|
+
text = session_mgr.get_scene()
|
|
183
|
+
if text:
|
|
184
|
+
console.print(
|
|
185
|
+
f"[bold]Scene memory[/bold] [dim]({topic})[/dim]:",
|
|
186
|
+
)
|
|
187
|
+
console.print(text)
|
|
188
|
+
else:
|
|
189
|
+
console.print(
|
|
190
|
+
f"[dim]No scene memory for '{topic}' yet. Add one "
|
|
191
|
+
f"with: /session scene <text>[/dim]",
|
|
192
|
+
)
|
|
193
|
+
elif rest == "clear":
|
|
194
|
+
session_mgr.set_scene("")
|
|
195
|
+
console.print(f"[green]Scene memory cleared ({topic})[/green]")
|
|
196
|
+
elif rest.startswith("set "):
|
|
197
|
+
text = rest[len("set ") :].strip()
|
|
198
|
+
if session_mgr.set_scene(text):
|
|
199
|
+
console.print(
|
|
200
|
+
f"[green]Scene memory replaced ({topic})[/green]",
|
|
201
|
+
)
|
|
202
|
+
else:
|
|
203
|
+
console.print("[red]Failed to write scene memory[/red]")
|
|
204
|
+
else:
|
|
205
|
+
if session_mgr.append_scene(rest):
|
|
206
|
+
console.print(
|
|
207
|
+
f"[green]Scene note appended ({topic})[/green]",
|
|
208
|
+
)
|
|
209
|
+
else:
|
|
210
|
+
console.print("[red]Failed to write scene memory[/red]")
|
|
211
|
+
|
|
140
212
|
else:
|
|
141
|
-
console.print(
|
|
142
|
-
"[dim]Usage:\n"
|
|
143
|
-
" /session — show current topic\n"
|
|
144
|
-
" /session new [name] — new session (default: default)\n"
|
|
145
|
-
" /session list — list all sessions\n"
|
|
146
|
-
" /session switch <n> — switch to a topic\n"
|
|
147
|
-
" /session rename <old> <new> — rename\n"
|
|
148
|
-
" /session remove <n> — remove session "
|
|
149
|
-
"(default cannot be removed)[/dim]",
|
|
150
|
-
)
|
|
213
|
+
console.print(_SESSION_USAGE)
|
|
@@ -7,6 +7,7 @@ from rich.console import Console
|
|
|
7
7
|
from rich.status import Status
|
|
8
8
|
|
|
9
9
|
from dashscope.acli.config import Config, MCPServerConfig
|
|
10
|
+
from dashscope.acli.mcp_stdio import StdioMCPClient
|
|
10
11
|
from dashscope.acli.platforms.bailian import MCPClient, MCPError
|
|
11
12
|
from dashscope.acli.skills import list_known_services
|
|
12
13
|
from dashscope.acli.tools.registry import registry
|
|
@@ -14,22 +15,34 @@ from dashscope.acli.tools.registry import registry
|
|
|
14
15
|
console = Console()
|
|
15
16
|
|
|
16
17
|
# Active MCP clients - shared state
|
|
17
|
-
_mcp_clients: dict[str, MCPClient] = {}
|
|
18
|
+
_mcp_clients: dict[str, MCPClient | StdioMCPClient] = {}
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
async def _connect_mcp(
|
|
21
|
+
async def _connect_mcp(
|
|
22
|
+
service: str,
|
|
23
|
+
config: Config,
|
|
24
|
+
url: str = "",
|
|
25
|
+
server: MCPServerConfig | None = None,
|
|
26
|
+
) -> str:
|
|
21
27
|
"""Connect to an MCP service and register its tools.
|
|
22
28
|
|
|
23
29
|
Returns empty string on success, error message on failure."""
|
|
24
30
|
if service in _mcp_clients:
|
|
25
31
|
return ""
|
|
26
32
|
|
|
33
|
+
use_stdio = bool(server) and (
|
|
34
|
+
(server.transport or "").lower() == "stdio" or bool(server.command)
|
|
35
|
+
)
|
|
27
36
|
try:
|
|
28
|
-
client
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
client: MCPClient | StdioMCPClient
|
|
38
|
+
if use_stdio:
|
|
39
|
+
client = StdioMCPClient(server.command, server.args)
|
|
40
|
+
else:
|
|
41
|
+
client = MCPClient(
|
|
42
|
+
service=service,
|
|
43
|
+
api_key=config.tongyi_api_key,
|
|
44
|
+
url=url,
|
|
45
|
+
)
|
|
33
46
|
except MCPError as e:
|
|
34
47
|
return str(e)
|
|
35
48
|
|
|
@@ -136,14 +149,21 @@ async def _handle_mcp_command(cmd: str, config: Config):
|
|
|
136
149
|
" /mcp — list connected services\n"
|
|
137
150
|
" /mcp list — show Bailian available services\n"
|
|
138
151
|
" /mcp add <svc> — add an MCP service\n"
|
|
139
|
-
" /mcp remove <svc> — remove an MCP service
|
|
152
|
+
" /mcp remove <svc> — remove an MCP service\n"
|
|
153
|
+
"Stdio servers: add [[mcp_servers]] in config.toml with "
|
|
154
|
+
'transport = "stdio", command and args[/dim]',
|
|
140
155
|
)
|
|
141
156
|
|
|
142
157
|
|
|
143
158
|
async def _init_mcp_servers(config: Config):
|
|
144
159
|
"""Connect to configured MCP servers on startup."""
|
|
145
160
|
for mcp_cfg in config.mcp_servers:
|
|
146
|
-
error = await _connect_mcp(
|
|
161
|
+
error = await _connect_mcp(
|
|
162
|
+
mcp_cfg.service,
|
|
163
|
+
config,
|
|
164
|
+
url=mcp_cfg.url,
|
|
165
|
+
server=mcp_cfg,
|
|
166
|
+
)
|
|
147
167
|
if not error:
|
|
148
168
|
client = _mcp_clients[mcp_cfg.service]
|
|
149
169
|
summary = f"{len(client.tools)} tools"
|
|
@@ -7,7 +7,7 @@ from rich.console import Console
|
|
|
7
7
|
|
|
8
8
|
from dashscope.acli import __version__
|
|
9
9
|
from dashscope.acli.cli.constants import ALL_CAPABILITY_KEYS
|
|
10
|
-
from dashscope.acli.config import
|
|
10
|
+
from dashscope.acli.config import Config
|
|
11
11
|
from dashscope.acli.tools.registry import registry
|
|
12
12
|
from dashscope.acli.utils import mask_secret
|
|
13
13
|
|
|
@@ -21,7 +21,8 @@ def _load_system_prompt() -> str | None:
|
|
|
21
21
|
are discovered separately by Agent.__init__ and passed to the prompt
|
|
22
22
|
pipeline for proper stable/ephemeral separation.
|
|
23
23
|
"""
|
|
24
|
-
|
|
24
|
+
# Imported at call time so tests can patch acli.config.WORKSPACE_DIR.
|
|
25
|
+
from dashscope.acli.config import CONFIG_DIR, WORKSPACE_DIR
|
|
25
26
|
|
|
26
27
|
base: str | None = None
|
|
27
28
|
for d in (WORKSPACE_DIR, CONFIG_DIR):
|
|
@@ -50,7 +51,7 @@ def _load_references() -> str | None:
|
|
|
50
51
|
Unlike skills (invoked on demand), references are knowledge docs that must
|
|
51
52
|
always be in the system prompt — e.g. generated SDK API indexes.
|
|
52
53
|
"""
|
|
53
|
-
from dashscope.acli.config import CONFIG_DIR
|
|
54
|
+
from dashscope.acli.config import CONFIG_DIR, WORKSPACE_DIR
|
|
54
55
|
|
|
55
56
|
parts: dict[str, str] = {}
|
|
56
57
|
for d in (CONFIG_DIR, WORKSPACE_DIR):
|
|
@@ -82,7 +83,9 @@ def _compose_system_prompt(base: str | None) -> str | None:
|
|
|
82
83
|
return f"{base}\n\n---\n\n{section}" if base else section
|
|
83
84
|
|
|
84
85
|
|
|
85
|
-
def _print_banner(config: Config | None = None):
|
|
86
|
+
def _print_banner(config: Config | None = None) -> None:
|
|
87
|
+
from dashscope.acli.config import WORKSPACE_DIR
|
|
88
|
+
|
|
86
89
|
logo = (
|
|
87
90
|
" _ _ _ ____ _ ___\n"
|
|
88
91
|
" / \\ __ _ ___ _ __ | |_(_) ___ / ___| | |_ _|\n"
|
|
@@ -38,7 +38,11 @@ HELP_SECTIONS: list[tuple[str, list[tuple[str, str]]]] = [
|
|
|
38
38
|
"JSON output mode (replies forced to JSON when on)",
|
|
39
39
|
),
|
|
40
40
|
("/compress", "Compress context (LLM summary replaces history)"),
|
|
41
|
-
(
|
|
41
|
+
(
|
|
42
|
+
"/history",
|
|
43
|
+
"Conversation history (stats/list/search/export/clear)",
|
|
44
|
+
),
|
|
45
|
+
("/undo", "Undo the last file write/delete (checkpoint)"),
|
|
42
46
|
(
|
|
43
47
|
"/feedback good|bad",
|
|
44
48
|
"Rate task satisfaction (stored in experience memory)",
|
|
@@ -106,7 +110,10 @@ HELP_SECTIONS: list[tuple[str, list[tuple[str, str]]]] = [
|
|
|
106
110
|
[
|
|
107
111
|
("/profile", "User profile (list/search/add/remove/clear)"),
|
|
108
112
|
("/memory", "Chat history (list/search/remove <id|num>/clear)"),
|
|
109
|
-
(
|
|
113
|
+
(
|
|
114
|
+
"/session",
|
|
115
|
+
"Sessions (new/list/switch/rename/fork/remove/scene)",
|
|
116
|
+
),
|
|
110
117
|
(
|
|
111
118
|
"/summarize",
|
|
112
119
|
"Summarize the current task; record key steps and lessons",
|