txcode-sdk 1.6.0__tar.gz → 1.7.0__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.
- {txcode_sdk-1.6.0/src/txcode_sdk.egg-info → txcode_sdk-1.7.0}/PKG-INFO +1 -1
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/pyproject.toml +1 -1
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/setup.py +1 -1
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/__init__.py +1 -1
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/base_agent.py +2 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/compact_mixin.py +9 -2
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/message_utils.py +1 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/summarizer/summarizer_agent.py +131 -127
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/client.py +32 -33
- txcode_sdk-1.7.0/src/txcode_sdk/config/runtime_settings.py +222 -0
- txcode_sdk-1.7.0/src/txcode_sdk/queue/__init__.py +30 -0
- txcode_sdk-1.7.0/src/txcode_sdk/queue/dispatcher.py +186 -0
- txcode_sdk-1.7.0/src/txcode_sdk/queue/handlers/__init__.py +7 -0
- txcode_sdk-1.7.0/src/txcode_sdk/queue/handlers/db_maintenance.py +49 -0
- txcode_sdk-1.7.0/src/txcode_sdk/queue/handlers/session_cleanup.py +93 -0
- txcode_sdk-1.7.0/src/txcode_sdk/queue/handlers/session_status_repair.py +23 -0
- txcode_sdk-1.7.0/src/txcode_sdk/queue/registry.py +52 -0
- txcode_sdk-1.7.0/src/txcode_sdk/queue/worker.py +140 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/config_store.py +25 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/http/chat_routes.py +3 -2
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/server.py +1 -0
- txcode_sdk-1.7.0/src/txcode_sdk/session/db.py +239 -0
- txcode_sdk-1.7.0/src/txcode_sdk/session/manager.py +420 -0
- txcode_sdk-1.7.0/src/txcode_sdk/session/migrations.py +148 -0
- txcode_sdk-1.7.0/src/txcode_sdk/session/repositories.py +326 -0
- txcode_sdk-1.7.0/src/txcode_sdk/session/retention.py +128 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0/src/txcode_sdk.egg-info}/PKG-INFO +1 -1
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk.egg-info/SOURCES.txt +20 -0
- txcode_sdk-1.7.0/tests/test_db_migrations.py +143 -0
- txcode_sdk-1.7.0/tests/test_job_queue.py +112 -0
- txcode_sdk-1.7.0/tests/test_message_repository.py +124 -0
- txcode_sdk-1.7.0/tests/test_py36_compat.py +123 -0
- txcode_sdk-1.7.0/tests/test_retention_maintenance.py +79 -0
- txcode_sdk-1.7.0/tests/test_session_cleanup.py +123 -0
- txcode_sdk-1.7.0/tests/test_session_repository.py +113 -0
- txcode_sdk-1.6.0/src/txcode_sdk/session/manager.py +0 -336
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/LICENSE +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/README.md +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/setup.cfg +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/example/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/example/code_example.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/example/code_session.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/example/code_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/example/constants.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/example/query_session.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/example/ws_server.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/_compat/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/_compat/dataclasses.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/_compat/resources.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/chat/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/chat/agent_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/chat/chat_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/chat/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/chat/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/code/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/code/agent_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/code/code_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/code/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/code/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/common/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/common/common_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/common/prompt/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/common/prompt/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/design/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/design/agent_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/design/design_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/design/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/design/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/discuss/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/discuss/agent_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/discuss/discuss_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/discuss/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/discuss/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/dream/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/dream/agent_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/dream/dream_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/dream/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/dream/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/factory.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/hook_mixin.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/mem/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/mem/agent_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/mem/mem_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/mem/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/mem/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/name/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/name/name_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/name/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/name/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/plan/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/plan/agent_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/plan/plan_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/plan/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/plan/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/prompt_builder.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/shell/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/shell/agent_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/shell/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/shell/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/shell/shell_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/skill/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/skill/agent_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/skill/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/skill/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/skill/skill_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/step_utils.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/summarizer/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/summarizer/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/summarizer/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/task/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/task/agent_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/task/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/task/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/task/task_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/test/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/test/agent_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/test/prompts/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/test/prompts/role.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/test/test_agent.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/agent/tool_registry.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/compact/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/compact/compressor.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/config/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/config/ai_settings.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/config/context_config.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/hooks/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/hooks/handlers/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/hooks/handlers/base.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/hooks/handlers/memory.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/hooks/processor.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/hooks/queue.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/hooks/types.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/provider/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/provider/base.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/provider/deepseek_provider.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/provider/openai_provider.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/provider/router.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/provider/txcode_ai.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/__main__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/git.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/handler.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/http/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/http/file_routes.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/http/git_routes.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/http/http_base.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/http/plan_code_routes.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/http/project_routes.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/http/session_routes.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/http/skill_routes.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/http/spec_routes.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/http/sys_config_routes.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/hub_client.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/json_store.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/plan_code.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/project_manager.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/provider_config.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/services/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/services/broadcaster.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/services/config_import_export.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/services/project_service.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/services/provider_service.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/skill_manager.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/spec_manager.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/websocket.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/yaml_lite.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/server/zip_utils.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/session/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/skills/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/specs/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/_util.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/bash.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/bash.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/code_search.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/code_search.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/edit_file.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/edit_file.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/edit_replacers.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/edit_similarity.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/email_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/email_tool.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/glob.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/glob.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/grep.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/grep.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/memory.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/memory.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/read_file.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/read_file.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/skill_tool.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/skill_tool.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/todo_read.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/todo_read.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/todo_write.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/todo_write.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/web_fetch.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/web_fetch.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/web_search.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/web_search.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/web_shell_exec.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/web_shell_exec.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/write_file.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/tools/write_file.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/types.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/utils/__init__.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/utils/format.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/utils/log.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/utils/multipart.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/utils/path_util.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk/utils/time_util.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk.egg-info/dependency_links.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk.egg-info/entry_points.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/src/txcode_sdk.egg-info/top_level.txt +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/tests/test_ai_settings.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/tests/test_chat_upload.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/tests/test_provider_reasoning_effort.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/tests/test_server_cli_logging.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/tests/test_sys_config_ai_settings.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/tests/test_sys_config_import_export.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/tests/test_txcode_ai.py +0 -0
- {txcode_sdk-1.6.0 → txcode_sdk-1.7.0}/tests/test_yaml_lite.py +0 -0
|
@@ -8,7 +8,7 @@ from setuptools import find_packages, setup
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name="txcode-sdk",
|
|
11
|
-
version="
|
|
11
|
+
version="1.7.0",
|
|
12
12
|
description="AI Agent SDK with built-in tools for Python projects",
|
|
13
13
|
long_description=open("README.md", encoding="utf-8").read(),
|
|
14
14
|
long_description_content_type="text/markdown",
|
|
@@ -131,6 +131,7 @@ class BaseAgent(
|
|
|
131
131
|
"agent run aborted | session=%s iteration=%d",
|
|
132
132
|
session_id, iteration,
|
|
133
133
|
)
|
|
134
|
+
self.release_session_refs()
|
|
134
135
|
return ChatResult(
|
|
135
136
|
answer="", steps=steps, session_id=session_id or "",
|
|
136
137
|
iterations=iteration, success=False, error="Aborted",
|
|
@@ -380,6 +381,7 @@ class BaseAgent(
|
|
|
380
381
|
logger.warning("last response: %s", _format_last_response(last_response))
|
|
381
382
|
|
|
382
383
|
success = final_answer != ""
|
|
384
|
+
self.release_session_refs()
|
|
383
385
|
return ChatResult(
|
|
384
386
|
answer=answer,
|
|
385
387
|
steps=steps,
|
|
@@ -19,6 +19,13 @@ class CompactMixin:
|
|
|
19
19
|
"""注入客户端的 ContextCompressor,确保 _check_and_compact 使用同一实例。"""
|
|
20
20
|
self._compressor = compressor
|
|
21
21
|
|
|
22
|
+
def release_session_refs(self):
|
|
23
|
+
"""释放本轮会话相关内存引用(DB 为唯一真源,长连接不驻留消息正文)。"""
|
|
24
|
+
self._base_messages = []
|
|
25
|
+
self._injected_user_message = ""
|
|
26
|
+
self._original_user_index = None
|
|
27
|
+
self._session_id = None
|
|
28
|
+
|
|
22
29
|
async def _check_and_compact(
|
|
23
30
|
self,
|
|
24
31
|
session_id: Optional[str],
|
|
@@ -67,9 +74,9 @@ class CompactMixin:
|
|
|
67
74
|
self._original_user_index = 0 if new_base else None
|
|
68
75
|
|
|
69
76
|
session = self._session_manager.get(session_id)
|
|
70
|
-
|
|
77
|
+
summary_id = (session or {}).get("summary_message_id")
|
|
71
78
|
summary_msgs = self._session_manager.get_messages_for_ai(
|
|
72
|
-
session_id,
|
|
79
|
+
session_id, summary_message_id=summary_id
|
|
73
80
|
)
|
|
74
81
|
for m in summary_msgs:
|
|
75
82
|
if m.get("role") == "system":
|
|
@@ -87,6 +87,7 @@ class MessageUtilsMixin:
|
|
|
87
87
|
session_id, role, saved_content,
|
|
88
88
|
keep_context=keep_context, is_original=is_original,
|
|
89
89
|
tool_call_id=tool_call_id, media_files=mf_list,
|
|
90
|
+
reasoning=reasoning,
|
|
90
91
|
)
|
|
91
92
|
|
|
92
93
|
def _history_to_chat_message(self, msg: dict) -> ChatMessage:
|
|
@@ -1,130 +1,134 @@
|
|
|
1
|
-
"""SummarizerAgent:会话压缩总结(Python 3.6 兼容)。
|
|
2
|
-
|
|
3
|
-
行为对齐 txcode `summarizer.agent.ts:compact`:
|
|
4
|
-
- /compact user 占位消息(keep_context=True)
|
|
5
|
-
- 过滤 role=='tool' 且 JSON 解析后 type=='tool_result' 的消息
|
|
6
|
-
- assistant_with_tools 反向解包 text/content,tool_result 反向解包 output
|
|
7
|
-
- provider.chat(messages)(max_tokens 由 Provider 内部硬编码,不在此处传参)
|
|
8
|
-
- 摘要写入 assistant(keep_context=True)后 update_summary + reset_tokens
|
|
9
|
-
- tokens_after = round(tokens_before * 0.3)
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
import json
|
|
13
|
-
from typing import Any, Optional
|
|
14
|
-
|
|
15
|
-
from ..._compat.dataclasses import dataclass
|
|
16
|
-
from ..._compat.resources import get_resource
|
|
17
|
-
from ...provider.base import BaseProvider
|
|
18
|
-
from ...types import ChatMessage
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@dataclass
|
|
22
|
-
class CompactCheck:
|
|
23
|
-
needed: bool
|
|
24
|
-
current_tokens: int
|
|
25
|
-
threshold: int
|
|
26
|
-
reason: str = ""
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@dataclass
|
|
30
|
-
class CompactResult:
|
|
31
|
-
success: bool
|
|
32
|
-
summary: str = ""
|
|
33
|
-
tokens_before: int = 0
|
|
34
|
-
tokens_after: int = 0
|
|
35
|
-
error: Optional[str] = None
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class SummarizerAgent:
|
|
39
|
-
def __init__(self, provider: BaseProvider, max_tokens: int = 150_000):
|
|
40
|
-
self._provider = provider
|
|
41
|
-
self._max_tokens = max_tokens
|
|
42
|
-
|
|
43
|
-
def check_needs_compact(self, session_data: Optional[dict], additional_tokens: int = 0) -> CompactCheck:
|
|
44
|
-
if not session_data:
|
|
45
|
-
return CompactCheck(needed=False, current_tokens=0, threshold=self._max_tokens, reason="No session")
|
|
46
|
-
|
|
47
|
-
prompt = session_data.get("prompt_tokens", 0)
|
|
48
|
-
completion = session_data.get("completion_tokens", 0)
|
|
49
|
-
total = prompt + completion + additional_tokens
|
|
50
|
-
threshold = self._max_tokens
|
|
51
|
-
needed = total >= threshold
|
|
52
|
-
return CompactCheck(
|
|
53
|
-
needed=needed,
|
|
54
|
-
current_tokens=total,
|
|
55
|
-
threshold=threshold,
|
|
56
|
-
reason="Above threshold" if needed else "Below threshold",
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
async def compact(self, session_manager: Any, session_id: str) -> CompactResult:
|
|
60
|
-
try:
|
|
61
|
-
session = session_manager.get(session_id)
|
|
62
|
-
if not session:
|
|
63
|
-
return CompactResult(success=False, error="Session not found")
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
msgs = session_manager.get_messages_for_ai(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
1
|
+
"""SummarizerAgent:会话压缩总结(Python 3.6 兼容)。
|
|
2
|
+
|
|
3
|
+
行为对齐 txcode `summarizer.agent.ts:compact`:
|
|
4
|
+
- /compact user 占位消息(keep_context=True)
|
|
5
|
+
- 过滤 role=='tool' 且 JSON 解析后 type=='tool_result' 的消息
|
|
6
|
+
- assistant_with_tools 反向解包 text/content,tool_result 反向解包 output
|
|
7
|
+
- provider.chat(messages)(max_tokens 由 Provider 内部硬编码,不在此处传参)
|
|
8
|
+
- 摘要写入 assistant(keep_context=True)后 update_summary + reset_tokens
|
|
9
|
+
- tokens_after = round(tokens_before * 0.3)
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import json
|
|
13
|
+
from typing import Any, Optional
|
|
14
|
+
|
|
15
|
+
from ..._compat.dataclasses import dataclass
|
|
16
|
+
from ..._compat.resources import get_resource
|
|
17
|
+
from ...provider.base import BaseProvider
|
|
18
|
+
from ...types import ChatMessage
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class CompactCheck:
|
|
23
|
+
needed: bool
|
|
24
|
+
current_tokens: int
|
|
25
|
+
threshold: int
|
|
26
|
+
reason: str = ""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@dataclass
|
|
30
|
+
class CompactResult:
|
|
31
|
+
success: bool
|
|
32
|
+
summary: str = ""
|
|
33
|
+
tokens_before: int = 0
|
|
34
|
+
tokens_after: int = 0
|
|
35
|
+
error: Optional[str] = None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class SummarizerAgent:
|
|
39
|
+
def __init__(self, provider: BaseProvider, max_tokens: int = 150_000):
|
|
40
|
+
self._provider = provider
|
|
41
|
+
self._max_tokens = max_tokens
|
|
42
|
+
|
|
43
|
+
def check_needs_compact(self, session_data: Optional[dict], additional_tokens: int = 0) -> CompactCheck:
|
|
44
|
+
if not session_data:
|
|
45
|
+
return CompactCheck(needed=False, current_tokens=0, threshold=self._max_tokens, reason="No session")
|
|
46
|
+
|
|
47
|
+
prompt = session_data.get("prompt_tokens", 0)
|
|
48
|
+
completion = session_data.get("completion_tokens", 0)
|
|
49
|
+
total = prompt + completion + additional_tokens
|
|
50
|
+
threshold = self._max_tokens
|
|
51
|
+
needed = total >= threshold
|
|
52
|
+
return CompactCheck(
|
|
53
|
+
needed=needed,
|
|
54
|
+
current_tokens=total,
|
|
55
|
+
threshold=threshold,
|
|
56
|
+
reason="Above threshold" if needed else "Below threshold",
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
async def compact(self, session_manager: Any, session_id: str) -> CompactResult:
|
|
60
|
+
try:
|
|
61
|
+
session = session_manager.get(session_id)
|
|
62
|
+
if not session:
|
|
63
|
+
return CompactResult(success=False, error="Session not found")
|
|
64
|
+
|
|
65
|
+
summary_message_id = session.get("summary_message_id")
|
|
66
|
+
msgs = session_manager.get_messages_for_ai(
|
|
67
|
+
session_id, summary_message_id=summary_message_id
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
if not msgs:
|
|
71
|
+
return CompactResult(success=False, error="No messages to compact")
|
|
72
|
+
|
|
73
|
+
tokens_before = (
|
|
74
|
+
session.get("prompt_tokens", 0) + session.get("completion_tokens", 0)
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
session_manager.add_message(
|
|
78
|
+
session_id, "user", "/compact", keep_context=True,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
chat_messages: list = []
|
|
82
|
+
for m in msgs:
|
|
83
|
+
role = m.get("role")
|
|
84
|
+
content = m.get("content", "")
|
|
85
|
+
if role == "tool":
|
|
86
|
+
continue
|
|
87
|
+
try:
|
|
88
|
+
parsed = json.loads(content)
|
|
89
|
+
if isinstance(parsed, dict):
|
|
90
|
+
ptype = parsed.get("type")
|
|
91
|
+
if ptype == "tool_result":
|
|
92
|
+
continue
|
|
93
|
+
if ptype == "assistant_with_tools":
|
|
94
|
+
content = parsed.get("text") or parsed.get("content") or content
|
|
95
|
+
elif ptype == "tool_result":
|
|
96
|
+
content = parsed.get("output") or content
|
|
97
|
+
except (json.JSONDecodeError, TypeError, ValueError):
|
|
98
|
+
pass
|
|
99
|
+
chat_messages.append(ChatMessage(role=role, content=content))
|
|
100
|
+
|
|
101
|
+
if not chat_messages:
|
|
102
|
+
return CompactResult(
|
|
103
|
+
success=False, error="No messages to compact after filter",
|
|
104
|
+
tokens_before=tokens_before, tokens_after=tokens_before,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
role_template = get_resource(
|
|
108
|
+
"txcode_sdk.agent.summarizer.prompts", "role.txt"
|
|
109
|
+
)
|
|
110
|
+
chat_messages.append(ChatMessage(role="user", content=role_template))
|
|
111
|
+
|
|
112
|
+
response = await self._provider.chat(chat_messages)
|
|
113
|
+
summary = (getattr(response, "content", "") or "").strip()
|
|
114
|
+
if not summary:
|
|
115
|
+
return CompactResult(
|
|
116
|
+
success=False, error="Empty summary",
|
|
117
|
+
tokens_before=tokens_before, tokens_after=tokens_before,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
summary_message_id = session_manager.add_message(
|
|
118
121
|
session_id, "assistant", summary, keep_context=True,
|
|
119
122
|
)
|
|
120
|
-
session_manager.update_summary(session_id,
|
|
123
|
+
session_manager.update_summary(session_id, summary_message_id)
|
|
121
124
|
session_manager.reset_tokens(session_id)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
return CompactResult(
|
|
128
|
+
success=True,
|
|
129
|
+
summary=summary,
|
|
130
|
+
tokens_before=tokens_before,
|
|
131
|
+
tokens_after=int(round(tokens_before * 0.3)),
|
|
132
|
+
)
|
|
133
|
+
except Exception as e:
|
|
134
|
+
return CompactResult(success=False, error=str(e))
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import json
|
|
5
|
+
import logging
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
from typing import Any, Callable, Dict, List, Optional
|
|
7
8
|
|
|
@@ -27,6 +28,8 @@ from .agent.name import NameAgent
|
|
|
27
28
|
from .agent.skill import SkillAgent
|
|
28
29
|
from .agent.base_agent import BaseAgent
|
|
29
30
|
|
|
31
|
+
logger = logging.getLogger(__name__)
|
|
32
|
+
|
|
30
33
|
|
|
31
34
|
class TxCodeClient:
|
|
32
35
|
def __init__(
|
|
@@ -139,10 +142,8 @@ class TxCodeClient:
|
|
|
139
142
|
self._provider.set_reasoning_effort(self._reasoning_effort)
|
|
140
143
|
|
|
141
144
|
def set_work_dir(self, work_dir: str):
|
|
142
|
-
"""
|
|
145
|
+
"""切项目(工作目录):会话存库不随目录重建,仅更新当前工作目录。"""
|
|
143
146
|
self._work_dir = work_dir
|
|
144
|
-
self._session_manager = SessionManager(work_dir)
|
|
145
|
-
self._compressor._session_manager = self._session_manager
|
|
146
147
|
|
|
147
148
|
def set_model_context_window(self, model_context_window: Optional[int]):
|
|
148
149
|
"""同步当前模型上下文窗口(如配置层能查到时调用)。"""
|
|
@@ -176,10 +177,13 @@ class TxCodeClient:
|
|
|
176
177
|
session = self._session_manager.create(title=message[:50])
|
|
177
178
|
session_id = session["id"]
|
|
178
179
|
|
|
180
|
+
self._enqueue_maintenance()
|
|
181
|
+
|
|
182
|
+
raw_messages: Optional[List[dict]] = None
|
|
179
183
|
if session_id and history is None:
|
|
180
|
-
|
|
184
|
+
summary_id = session.get("summary_message_id")
|
|
181
185
|
raw_messages = self._session_manager.get_messages_for_ai(
|
|
182
|
-
session_id,
|
|
186
|
+
session_id, summary_message_id=summary_id
|
|
183
187
|
)
|
|
184
188
|
if raw_messages:
|
|
185
189
|
history = self._parse_session_messages_to_history(raw_messages)
|
|
@@ -220,15 +224,19 @@ class TxCodeClient:
|
|
|
220
224
|
result.session_id = session_id
|
|
221
225
|
return result
|
|
222
226
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
227
|
+
try:
|
|
228
|
+
result = await agent.run(
|
|
229
|
+
user_message=message,
|
|
230
|
+
session_id=session_id,
|
|
231
|
+
history=history,
|
|
232
|
+
media_files=media_files,
|
|
233
|
+
on_step=on_step,
|
|
234
|
+
on_compact=on_compact,
|
|
235
|
+
abort_signal=abort_signal,
|
|
236
|
+
)
|
|
237
|
+
finally:
|
|
238
|
+
history = None
|
|
239
|
+
raw_messages = None
|
|
232
240
|
|
|
233
241
|
if session_id and result.usage and self._session_manager and \
|
|
234
242
|
(result.usage.prompt_tokens or result.usage.completion_tokens):
|
|
@@ -307,22 +315,13 @@ class TxCodeClient:
|
|
|
307
315
|
return result
|
|
308
316
|
|
|
309
317
|
def _create_session_with_id(self, session_id: str, title: str) -> dict:
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
"
|
|
318
|
-
|
|
319
|
-
"
|
|
320
|
-
"summary_message_index": None,
|
|
321
|
-
"messages": [],
|
|
322
|
-
}
|
|
323
|
-
session_dir = Path(self._work_dir) / ".txcode" / "session"
|
|
324
|
-
session_dir.mkdir(parents=True, exist_ok=True)
|
|
325
|
-
session_path = session_dir / f"session_{session_id}.json"
|
|
326
|
-
with open(session_path, "w", encoding="utf-8") as f:
|
|
327
|
-
json.dump(session, f, ensure_ascii=False, indent=2)
|
|
328
|
-
return session
|
|
318
|
+
return self._session_manager.create(title=title[:50], session_id=session_id)
|
|
319
|
+
|
|
320
|
+
def _enqueue_maintenance(self):
|
|
321
|
+
"""发消息即投递归档清理(内存入队,微秒级;失败不影响对话)。"""
|
|
322
|
+
try:
|
|
323
|
+
from .queue.dispatcher import enqueue
|
|
324
|
+
|
|
325
|
+
enqueue("session_cleanup", {"workDir": self._work_dir})
|
|
326
|
+
except Exception as exc:
|
|
327
|
+
logger.warning("enqueue session_cleanup failed | error=%s", exc)
|