hdsp-jupyter-extension 2.0.27__py3-none-any.whl → 2.0.29__py3-none-any.whl
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.
- agent_server/config/__init__.py +5 -0
- agent_server/config/server_config.py +213 -0
- agent_server/context_providers/__init__.py +4 -2
- agent_server/context_providers/actions.py +73 -7
- agent_server/context_providers/file.py +23 -23
- agent_server/core/__init__.py +2 -2
- agent_server/core/llm_service.py +2 -3
- agent_server/langchain/__init__.py +2 -2
- agent_server/langchain/agent.py +18 -251
- agent_server/langchain/agent_factory.py +26 -4
- agent_server/langchain/agent_prompts/planner_prompt.py +22 -31
- agent_server/langchain/custom_middleware.py +268 -43
- agent_server/langchain/llm_factory.py +102 -54
- agent_server/langchain/logging_utils.py +1 -1
- agent_server/langchain/middleware/__init__.py +5 -0
- agent_server/langchain/middleware/content_injection_middleware.py +110 -0
- agent_server/langchain/middleware/subagent_events.py +88 -9
- agent_server/langchain/middleware/subagent_middleware.py +501 -245
- agent_server/langchain/prompts.py +5 -22
- agent_server/langchain/state_schema.py +44 -0
- agent_server/langchain/tools/jupyter_tools.py +4 -5
- agent_server/langchain/tools/tool_registry.py +6 -0
- agent_server/main.py +4 -4
- agent_server/routers/agent.py +2 -2
- agent_server/routers/chat.py +334 -28
- agent_server/routers/config.py +197 -11
- agent_server/routers/config_schema.py +254 -0
- agent_server/routers/context.py +31 -8
- agent_server/routers/langchain_agent.py +348 -209
- hdsp_agent_core/managers/config_manager.py +60 -11
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/build_log.json +1 -1
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/package.json +2 -2
- hdsp_jupyter_extension-2.0.27.data/data/share/jupyter/labextensions/hdsp-agent/static/frontend_styles_index_js.b5e4416b4e07ec087aad.js → hdsp_jupyter_extension-2.0.29.data/data/share/jupyter/labextensions/hdsp-agent/static/frontend_styles_index_js.f2eca2f8fa682eb21f72.js +488 -25
- hdsp_jupyter_extension-2.0.29.data/data/share/jupyter/labextensions/hdsp-agent/static/frontend_styles_index_js.f2eca2f8fa682eb21f72.js.map +1 -0
- jupyter_ext/labextension/static/lib_index_js.67505497667f9c0a763d.js → hdsp_jupyter_extension-2.0.29.data/data/share/jupyter/labextensions/hdsp-agent/static/lib_index_js.cc0a7158a5e3de7f22f7.js +1327 -1054
- hdsp_jupyter_extension-2.0.29.data/data/share/jupyter/labextensions/hdsp-agent/static/lib_index_js.cc0a7158a5e3de7f22f7.js.map +1 -0
- hdsp_jupyter_extension-2.0.27.data/data/share/jupyter/labextensions/hdsp-agent/static/remoteEntry.4ab73bb5068405670214.js → hdsp_jupyter_extension-2.0.29.data/data/share/jupyter/labextensions/hdsp-agent/static/remoteEntry.bfff374b5cc6a57e16d2.js +3 -3
- jupyter_ext/labextension/static/remoteEntry.4ab73bb5068405670214.js.map → hdsp_jupyter_extension-2.0.29.data/data/share/jupyter/labextensions/hdsp-agent/static/remoteEntry.bfff374b5cc6a57e16d2.js.map +1 -1
- {hdsp_jupyter_extension-2.0.27.dist-info → hdsp_jupyter_extension-2.0.29.dist-info}/METADATA +1 -1
- {hdsp_jupyter_extension-2.0.27.dist-info → hdsp_jupyter_extension-2.0.29.dist-info}/RECORD +71 -67
- jupyter_ext/_version.py +1 -1
- jupyter_ext/handlers.py +41 -0
- jupyter_ext/labextension/build_log.json +1 -1
- jupyter_ext/labextension/package.json +2 -2
- jupyter_ext/labextension/static/{frontend_styles_index_js.b5e4416b4e07ec087aad.js → frontend_styles_index_js.f2eca2f8fa682eb21f72.js} +488 -25
- jupyter_ext/labextension/static/frontend_styles_index_js.f2eca2f8fa682eb21f72.js.map +1 -0
- hdsp_jupyter_extension-2.0.27.data/data/share/jupyter/labextensions/hdsp-agent/static/lib_index_js.67505497667f9c0a763d.js → jupyter_ext/labextension/static/lib_index_js.cc0a7158a5e3de7f22f7.js +1327 -1054
- jupyter_ext/labextension/static/lib_index_js.cc0a7158a5e3de7f22f7.js.map +1 -0
- jupyter_ext/labextension/static/{remoteEntry.4ab73bb5068405670214.js → remoteEntry.bfff374b5cc6a57e16d2.js} +3 -3
- hdsp_jupyter_extension-2.0.27.data/data/share/jupyter/labextensions/hdsp-agent/static/remoteEntry.4ab73bb5068405670214.js.map → jupyter_ext/labextension/static/remoteEntry.bfff374b5cc6a57e16d2.js.map +1 -1
- agent_server/langchain/middleware/description_injector.py +0 -150
- hdsp_jupyter_extension-2.0.27.data/data/share/jupyter/labextensions/hdsp-agent/static/frontend_styles_index_js.b5e4416b4e07ec087aad.js.map +0 -1
- hdsp_jupyter_extension-2.0.27.data/data/share/jupyter/labextensions/hdsp-agent/static/lib_index_js.67505497667f9c0a763d.js.map +0 -1
- jupyter_ext/labextension/static/frontend_styles_index_js.b5e4416b4e07ec087aad.js.map +0 -1
- jupyter_ext/labextension/static/lib_index_js.67505497667f9c0a763d.js.map +0 -1
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/etc/jupyter/jupyter_server_config.d/hdsp_jupyter_extension.json +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/install.json +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/node_modules_emotion_use-insertion-effect-with-fallbacks_dist_emotion-use-insertion-effect-wi-3ba6b80.c095373419d05e6f141a.js +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/node_modules_emotion_use-insertion-effect-with-fallbacks_dist_emotion-use-insertion-effect-wi-3ba6b80.c095373419d05e6f141a.js.map +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/node_modules_emotion_use-insertion-effect-with-fallbacks_dist_emotion-use-insertion-effect-wi-3ba6b81.61e75fb98ecff46cf836.js +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/node_modules_emotion_use-insertion-effect-with-fallbacks_dist_emotion-use-insertion-effect-wi-3ba6b81.61e75fb98ecff46cf836.js.map +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/style.js +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/vendors-node_modules_babel_runtime_helpers_esm_extends_js-node_modules_emotion_serialize_dist-051195.e2553aab0c3963b83dd7.js +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/vendors-node_modules_babel_runtime_helpers_esm_extends_js-node_modules_emotion_serialize_dist-051195.e2553aab0c3963b83dd7.js.map +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/vendors-node_modules_emotion_cache_dist_emotion-cache_browser_development_esm_js.24edcc52a1c014a8a5f0.js +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/vendors-node_modules_emotion_cache_dist_emotion-cache_browser_development_esm_js.24edcc52a1c014a8a5f0.js.map +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/vendors-node_modules_emotion_react_dist_emotion-react_browser_development_esm_js.19ecf6babe00caff6b8a.js +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/vendors-node_modules_emotion_react_dist_emotion-react_browser_development_esm_js.19ecf6babe00caff6b8a.js.map +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/vendors-node_modules_emotion_styled_dist_emotion-styled_browser_development_esm_js.661fb5836f4978a7c6e1.js +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/vendors-node_modules_emotion_styled_dist_emotion-styled_browser_development_esm_js.661fb5836f4978a7c6e1.js.map +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/vendors-node_modules_mui_material_index_js.985697e0162d8d088ca2.js +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/vendors-node_modules_mui_material_index_js.985697e0162d8d088ca2.js.map +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/vendors-node_modules_mui_material_utils_createSvgIcon_js.1f5038488cdfd8b3a85d.js +0 -0
- {hdsp_jupyter_extension-2.0.27.data → hdsp_jupyter_extension-2.0.29.data}/data/share/jupyter/labextensions/hdsp-agent/static/vendors-node_modules_mui_material_utils_createSvgIcon_js.1f5038488cdfd8b3a85d.js.map +0 -0
- {hdsp_jupyter_extension-2.0.27.dist-info → hdsp_jupyter_extension-2.0.29.dist-info}/WHEEL +0 -0
- {hdsp_jupyter_extension-2.0.27.dist-info → hdsp_jupyter_extension-2.0.29.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Server Configuration Manager - Agent Server specific settings
|
|
3
|
+
|
|
4
|
+
This config manager handles all LLM and server settings.
|
|
5
|
+
Stored in ~/.hdsp_agent/server_config.json
|
|
6
|
+
|
|
7
|
+
This is separate from the client-side config which only stores agentServerUrl.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
import tempfile
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import Any, Dict
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ServerConfigManager:
|
|
18
|
+
"""Manage Agent Server configuration persistence"""
|
|
19
|
+
|
|
20
|
+
_instance = None
|
|
21
|
+
_config_file = None
|
|
22
|
+
|
|
23
|
+
def __init__(self):
|
|
24
|
+
try:
|
|
25
|
+
# 1순위: 환경변수
|
|
26
|
+
config_dir = os.environ.get("HDSP_AGENT_CONFIG_DIR")
|
|
27
|
+
|
|
28
|
+
# 2순위: 홈 디렉토리 ~/.hdsp_agent
|
|
29
|
+
if not config_dir:
|
|
30
|
+
try:
|
|
31
|
+
config_dir = os.path.expanduser("~/.hdsp_agent")
|
|
32
|
+
except Exception:
|
|
33
|
+
config_dir = None
|
|
34
|
+
|
|
35
|
+
# 경로가 유효한지 체크하고, 없으면 생성 시도
|
|
36
|
+
if config_dir:
|
|
37
|
+
config_path = Path(config_dir)
|
|
38
|
+
try:
|
|
39
|
+
config_path.mkdir(parents=True, exist_ok=True)
|
|
40
|
+
self._config_file = config_path / "server_config.json"
|
|
41
|
+
except Exception as e:
|
|
42
|
+
print(f"Warning: Cannot write to {config_dir}: {e}")
|
|
43
|
+
self._config_file = None
|
|
44
|
+
|
|
45
|
+
# 3순위 (비상용): 쓰기 실패했거나 경로가 없으면 /tmp 사용
|
|
46
|
+
if not self._config_file:
|
|
47
|
+
tmp_dir = Path(tempfile.gettempdir()) / "hdsp_agent_server"
|
|
48
|
+
tmp_dir.mkdir(parents=True, exist_ok=True)
|
|
49
|
+
self._config_file = tmp_dir / "server_config.json"
|
|
50
|
+
print(f"Using temporary config path: {self._config_file}")
|
|
51
|
+
|
|
52
|
+
except Exception as e:
|
|
53
|
+
print(f"Critical Error in ServerConfigManager init: {e}")
|
|
54
|
+
self._config_file = Path("/tmp/hdsp_agent_server_config_fallback.json")
|
|
55
|
+
|
|
56
|
+
self._config = self._load_config()
|
|
57
|
+
print(f"ServerConfigManager initialized: {self._config_file}")
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def get_instance(cls):
|
|
61
|
+
"""Get singleton instance"""
|
|
62
|
+
if cls._instance is None:
|
|
63
|
+
cls._instance = ServerConfigManager()
|
|
64
|
+
return cls._instance
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def reset_instance(cls):
|
|
68
|
+
"""Reset singleton instance (for testing)"""
|
|
69
|
+
cls._instance = None
|
|
70
|
+
|
|
71
|
+
def _load_config(self) -> Dict[str, Any]:
|
|
72
|
+
"""Load configuration from file"""
|
|
73
|
+
if not self._config_file.exists():
|
|
74
|
+
return self._default_config()
|
|
75
|
+
|
|
76
|
+
try:
|
|
77
|
+
with open(self._config_file, "r") as f:
|
|
78
|
+
loaded = json.load(f)
|
|
79
|
+
# Merge with defaults to ensure all keys exist
|
|
80
|
+
defaults = self._default_config()
|
|
81
|
+
defaults.update(loaded)
|
|
82
|
+
return defaults
|
|
83
|
+
except (json.JSONDecodeError, IOError) as e:
|
|
84
|
+
print(f"Error loading server config: {e}")
|
|
85
|
+
return self._default_config()
|
|
86
|
+
|
|
87
|
+
def _default_config(self) -> Dict[str, Any]:
|
|
88
|
+
"""Get default server configuration"""
|
|
89
|
+
return {
|
|
90
|
+
# LLM Provider Settings
|
|
91
|
+
"provider": "gemini",
|
|
92
|
+
"gemini": {
|
|
93
|
+
"apiKey": "",
|
|
94
|
+
"apiKeys": [],
|
|
95
|
+
"model": "gemini-2.5-flash"
|
|
96
|
+
},
|
|
97
|
+
"openai": {
|
|
98
|
+
"apiKey": "",
|
|
99
|
+
"model": "gpt-4o"
|
|
100
|
+
},
|
|
101
|
+
"vllm": {
|
|
102
|
+
"endpoint": "https://openrouter.ai/api/v1",
|
|
103
|
+
"apiKey": "",
|
|
104
|
+
"model": "openai/gpt-4o",
|
|
105
|
+
"useResponsesApi": False
|
|
106
|
+
},
|
|
107
|
+
# Summarization LLM
|
|
108
|
+
"summarization": {
|
|
109
|
+
"enabled": False,
|
|
110
|
+
"provider": "gemini",
|
|
111
|
+
"model": None,
|
|
112
|
+
"endpoint": "",
|
|
113
|
+
"apiKey": ""
|
|
114
|
+
},
|
|
115
|
+
# Embedding
|
|
116
|
+
"embedding": {
|
|
117
|
+
"provider": "openai",
|
|
118
|
+
"model": "text-embedding-3-small",
|
|
119
|
+
"apiKey": "",
|
|
120
|
+
"endpoint": ""
|
|
121
|
+
},
|
|
122
|
+
# RAG
|
|
123
|
+
"rag": {
|
|
124
|
+
"qdrantUrl": "http://localhost:6333",
|
|
125
|
+
"collectionName": "hdsp_docs"
|
|
126
|
+
},
|
|
127
|
+
# Server Settings
|
|
128
|
+
"agentServerTimeout": 120.0,
|
|
129
|
+
"idleTimeout": 3600, # 1 hour default
|
|
130
|
+
# Prompts (None = use defaults)
|
|
131
|
+
"prompts": {
|
|
132
|
+
"planner": None,
|
|
133
|
+
"python_developer": None,
|
|
134
|
+
"researcher": None,
|
|
135
|
+
"athena_query": None
|
|
136
|
+
},
|
|
137
|
+
# Feature Toggles
|
|
138
|
+
"useResponsesApi": False
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
def get_config(self) -> Dict[str, Any]:
|
|
142
|
+
"""Get current configuration"""
|
|
143
|
+
self._config = self._load_config()
|
|
144
|
+
return self._config.copy()
|
|
145
|
+
|
|
146
|
+
def save_config(self, config: Dict[str, Any]):
|
|
147
|
+
"""Save configuration to file"""
|
|
148
|
+
self._config.update(config)
|
|
149
|
+
self._config_file.parent.mkdir(parents=True, exist_ok=True)
|
|
150
|
+
|
|
151
|
+
try:
|
|
152
|
+
with open(self._config_file, "w") as f:
|
|
153
|
+
json.dump(self._config, f, indent=2)
|
|
154
|
+
except IOError as e:
|
|
155
|
+
raise RuntimeError(f"Failed to save server config: {e}")
|
|
156
|
+
|
|
157
|
+
def get(self, key: str, default=None):
|
|
158
|
+
"""Get specific config value"""
|
|
159
|
+
return self._config.get(key, default)
|
|
160
|
+
|
|
161
|
+
def set(self, key: str, value: Any):
|
|
162
|
+
"""Set specific config value"""
|
|
163
|
+
self._config[key] = value
|
|
164
|
+
self.save_config(self._config)
|
|
165
|
+
|
|
166
|
+
def update_config(self, updates: Dict[str, Any]):
|
|
167
|
+
"""Update configuration with partial updates (deep merge for nested dicts)"""
|
|
168
|
+
for key, value in updates.items():
|
|
169
|
+
if (
|
|
170
|
+
key in self._config
|
|
171
|
+
and isinstance(self._config[key], dict)
|
|
172
|
+
and isinstance(value, dict)
|
|
173
|
+
):
|
|
174
|
+
self._config[key].update(value)
|
|
175
|
+
else:
|
|
176
|
+
self._config[key] = value
|
|
177
|
+
self.save_config(self._config)
|
|
178
|
+
|
|
179
|
+
def get_admin_config(self) -> Dict[str, Any]:
|
|
180
|
+
"""Get all server configuration (for admin API)"""
|
|
181
|
+
config = self.get_config()
|
|
182
|
+
# Return everything except internal keys
|
|
183
|
+
return config.copy()
|
|
184
|
+
|
|
185
|
+
def update_admin_config(self, updates: Dict[str, Any]):
|
|
186
|
+
"""Update server configuration"""
|
|
187
|
+
self.update_config(updates)
|
|
188
|
+
|
|
189
|
+
def get_user_config(self) -> Dict[str, Any]:
|
|
190
|
+
"""Get user configuration.
|
|
191
|
+
|
|
192
|
+
NOTE: User preferences (workspaceRoot, autoApprove) are now stored
|
|
193
|
+
in browser localStorage. This method returns defaults for backward
|
|
194
|
+
compatibility with the API.
|
|
195
|
+
"""
|
|
196
|
+
return {
|
|
197
|
+
"workspaceRoot": "",
|
|
198
|
+
"temperature": 0.7,
|
|
199
|
+
"autoApprove": False
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
def update_user_config(self, updates: Dict[str, Any]):
|
|
203
|
+
"""Update user configuration.
|
|
204
|
+
|
|
205
|
+
NOTE: User preferences are stored in browser localStorage.
|
|
206
|
+
This is a no-op for backward compatibility.
|
|
207
|
+
"""
|
|
208
|
+
pass # No-op: user config is in localStorage
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def get_server_config_manager() -> ServerConfigManager:
|
|
212
|
+
"""Get the singleton ServerConfigManager instance"""
|
|
213
|
+
return ServerConfigManager.get_instance()
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Context Providers Module
|
|
3
3
|
|
|
4
4
|
Provides context injection for LLM prompts (e.g., @file, @notebook, @selection).
|
|
5
|
-
Also provides action commands (e.g.,
|
|
5
|
+
Also provides action commands (e.g., /reset).
|
|
6
6
|
Inspired by jupyter-ai's context provider architecture.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
-
from .actions import ResetContextProvider
|
|
9
|
+
from .actions import CompactContextProvider, HelpContextProvider, ResetContextProvider
|
|
10
10
|
from .base import BaseContextProvider, ContextCommand, find_commands
|
|
11
11
|
from .file import FileContextProvider
|
|
12
12
|
from .processor import ContextProcessor, process_context_commands
|
|
@@ -16,6 +16,8 @@ __all__ = [
|
|
|
16
16
|
"BaseContextProvider",
|
|
17
17
|
"FileContextProvider",
|
|
18
18
|
"ResetContextProvider",
|
|
19
|
+
"CompactContextProvider",
|
|
20
|
+
"HelpContextProvider",
|
|
19
21
|
"ContextProcessor",
|
|
20
22
|
"find_commands",
|
|
21
23
|
"process_context_commands",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Action Context Providers
|
|
3
3
|
|
|
4
|
-
These providers handle action commands like
|
|
4
|
+
These providers handle action commands like /reset that perform actions
|
|
5
5
|
rather than providing context to the LLM.
|
|
6
6
|
"""
|
|
7
7
|
|
|
@@ -13,11 +13,11 @@ class ResetContextProvider(BaseContextProvider):
|
|
|
13
13
|
Action provider for resetting the session.
|
|
14
14
|
|
|
15
15
|
Usage:
|
|
16
|
-
|
|
16
|
+
/reset - Clear conversation history and recreate agent
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
|
-
id = "
|
|
20
|
-
description = "
|
|
19
|
+
id = "/reset"
|
|
20
|
+
description = "세션 초기화 및 에이전트 리셋"
|
|
21
21
|
requires_arg = False
|
|
22
22
|
only_start = False
|
|
23
23
|
|
|
@@ -25,15 +25,15 @@ class ResetContextProvider(BaseContextProvider):
|
|
|
25
25
|
super().__init__(base_dir)
|
|
26
26
|
|
|
27
27
|
def get_arg_options(self, arg_prefix: str) -> list[ListOptionsEntry]:
|
|
28
|
-
"""No arguments for
|
|
28
|
+
"""No arguments for /reset."""
|
|
29
29
|
return []
|
|
30
30
|
|
|
31
31
|
def make_context(self, command: ContextCommand) -> str:
|
|
32
|
-
"""
|
|
32
|
+
"""/reset doesn't provide context - it's an action command."""
|
|
33
33
|
return ""
|
|
34
34
|
|
|
35
35
|
def replace_command(self, command: ContextCommand) -> str:
|
|
36
|
-
"""Replace
|
|
36
|
+
"""Replace /reset with empty string (it's an action, not context)."""
|
|
37
37
|
return ""
|
|
38
38
|
|
|
39
39
|
def is_action_command(self) -> bool:
|
|
@@ -43,3 +43,69 @@ class ResetContextProvider(BaseContextProvider):
|
|
|
43
43
|
|
|
44
44
|
# Add more action commands here as needed
|
|
45
45
|
# Example: @clear, @help, @history, etc.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class CompactContextProvider(BaseContextProvider):
|
|
49
|
+
"""
|
|
50
|
+
Action provider for compacting conversation history.
|
|
51
|
+
|
|
52
|
+
Usage:
|
|
53
|
+
/compact - Summarize older messages, keep recent 3 intact
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
id = "/compact"
|
|
57
|
+
description = "대화 기록 압축 및 요약"
|
|
58
|
+
requires_arg = False
|
|
59
|
+
only_start = False
|
|
60
|
+
|
|
61
|
+
def __init__(self, base_dir: str = "."):
|
|
62
|
+
super().__init__(base_dir)
|
|
63
|
+
|
|
64
|
+
def get_arg_options(self, arg_prefix: str) -> list[ListOptionsEntry]:
|
|
65
|
+
"""No arguments for /compact."""
|
|
66
|
+
return []
|
|
67
|
+
|
|
68
|
+
def make_context(self, command: ContextCommand) -> str:
|
|
69
|
+
"""/compact doesn't provide context - it's an action command."""
|
|
70
|
+
return ""
|
|
71
|
+
|
|
72
|
+
def replace_command(self, command: ContextCommand) -> str:
|
|
73
|
+
"""Replace /compact with empty string (it's an action, not context)."""
|
|
74
|
+
return ""
|
|
75
|
+
|
|
76
|
+
def is_action_command(self) -> bool:
|
|
77
|
+
"""Indicate this is an action command."""
|
|
78
|
+
return True
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class HelpContextProvider(BaseContextProvider):
|
|
82
|
+
"""
|
|
83
|
+
Action provider for displaying help information.
|
|
84
|
+
|
|
85
|
+
Usage:
|
|
86
|
+
/help - Show available commands and features guide
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
id = "/help"
|
|
90
|
+
description = "도움말 및 사용 가이드"
|
|
91
|
+
requires_arg = False
|
|
92
|
+
only_start = False
|
|
93
|
+
|
|
94
|
+
def __init__(self, base_dir: str = "."):
|
|
95
|
+
super().__init__(base_dir)
|
|
96
|
+
|
|
97
|
+
def get_arg_options(self, arg_prefix: str) -> list[ListOptionsEntry]:
|
|
98
|
+
"""No arguments for /help."""
|
|
99
|
+
return []
|
|
100
|
+
|
|
101
|
+
def make_context(self, command: ContextCommand) -> str:
|
|
102
|
+
"""/help doesn't provide context - it's an action command."""
|
|
103
|
+
return ""
|
|
104
|
+
|
|
105
|
+
def replace_command(self, command: ContextCommand) -> str:
|
|
106
|
+
"""Replace /help with empty string (it's an action, not context)."""
|
|
107
|
+
return ""
|
|
108
|
+
|
|
109
|
+
def is_action_command(self) -> bool:
|
|
110
|
+
"""Indicate this is an action command."""
|
|
111
|
+
return True
|
|
@@ -73,7 +73,7 @@ class FileContextProvider(BaseContextProvider):
|
|
|
73
73
|
"""
|
|
74
74
|
|
|
75
75
|
id = "@file"
|
|
76
|
-
description = "
|
|
76
|
+
description = "파일 내용을 프롬프트에 포함"
|
|
77
77
|
requires_arg = True
|
|
78
78
|
only_start = False
|
|
79
79
|
|
|
@@ -152,7 +152,7 @@ class FileContextProvider(BaseContextProvider):
|
|
|
152
152
|
ListOptionsEntry(
|
|
153
153
|
id=self.command_id,
|
|
154
154
|
label=f"{self.command_id}:{label_path}",
|
|
155
|
-
description="
|
|
155
|
+
description="디렉토리"
|
|
156
156
|
if is_dir
|
|
157
157
|
else self._get_file_description(path),
|
|
158
158
|
only_start=self.only_start,
|
|
@@ -168,26 +168,26 @@ class FileContextProvider(BaseContextProvider):
|
|
|
168
168
|
basename = os.path.basename(filepath)
|
|
169
169
|
|
|
170
170
|
descriptions = {
|
|
171
|
-
".py": "Python
|
|
172
|
-
".ipynb": "Jupyter
|
|
173
|
-
".md": "Markdown
|
|
174
|
-
".txt": "
|
|
175
|
-
".json": "JSON
|
|
176
|
-
".yaml": "YAML
|
|
177
|
-
".yml": "YAML
|
|
178
|
-
".toml": "TOML
|
|
179
|
-
".js": "JavaScript
|
|
180
|
-
".ts": "TypeScript
|
|
181
|
-
".tsx": "TypeScript React
|
|
182
|
-
".jsx": "JavaScript React
|
|
183
|
-
".html": "HTML
|
|
184
|
-
".css": "CSS
|
|
185
|
-
".sql": "SQL
|
|
186
|
-
".sh": "
|
|
187
|
-
".csv": "CSV
|
|
188
|
-
".r": "R
|
|
189
|
-
".R": "R
|
|
190
|
-
".jl": "Julia
|
|
171
|
+
".py": "Python 파일",
|
|
172
|
+
".ipynb": "Jupyter 노트북",
|
|
173
|
+
".md": "Markdown 파일",
|
|
174
|
+
".txt": "텍스트 파일",
|
|
175
|
+
".json": "JSON 파일",
|
|
176
|
+
".yaml": "YAML 파일",
|
|
177
|
+
".yml": "YAML 파일",
|
|
178
|
+
".toml": "TOML 파일",
|
|
179
|
+
".js": "JavaScript 파일",
|
|
180
|
+
".ts": "TypeScript 파일",
|
|
181
|
+
".tsx": "TypeScript React 파일",
|
|
182
|
+
".jsx": "JavaScript React 파일",
|
|
183
|
+
".html": "HTML 파일",
|
|
184
|
+
".css": "CSS 파일",
|
|
185
|
+
".sql": "SQL 파일",
|
|
186
|
+
".sh": "셸 스크립트",
|
|
187
|
+
".csv": "CSV 파일",
|
|
188
|
+
".r": "R 파일",
|
|
189
|
+
".R": "R 파일",
|
|
190
|
+
".jl": "Julia 파일",
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
# Check special filenames
|
|
@@ -196,7 +196,7 @@ class FileContextProvider(BaseContextProvider):
|
|
|
196
196
|
if basename == "Makefile":
|
|
197
197
|
return "Makefile"
|
|
198
198
|
|
|
199
|
-
return descriptions.get(ext, "
|
|
199
|
+
return descriptions.get(ext, "파일")
|
|
200
200
|
|
|
201
201
|
def make_context(self, command: ContextCommand) -> str:
|
|
202
202
|
"""
|
agent_server/core/__init__.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Core services for HDSP Agent Server
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from
|
|
5
|
+
from agent_server.config import ServerConfigManager
|
|
6
6
|
from hdsp_agent_core.managers.session_manager import (
|
|
7
7
|
ChatMessage,
|
|
8
8
|
Session,
|
|
@@ -47,7 +47,7 @@ from .state_verifier import (
|
|
|
47
47
|
from .summary_generator import SummaryGenerator, TaskType, get_summary_generator
|
|
48
48
|
|
|
49
49
|
__all__ = [
|
|
50
|
-
"
|
|
50
|
+
"ServerConfigManager",
|
|
51
51
|
"LLMClient",
|
|
52
52
|
"LLMService",
|
|
53
53
|
"PromptBuilder",
|
agent_server/core/llm_service.py
CHANGED
|
@@ -28,11 +28,10 @@ class LLMService:
|
|
|
28
28
|
return self._key_manager
|
|
29
29
|
if self.provider == "gemini":
|
|
30
30
|
try:
|
|
31
|
-
from
|
|
32
|
-
|
|
31
|
+
from agent_server.config import ServerConfigManager
|
|
33
32
|
from agent_server.core.api_key_manager import get_key_manager
|
|
34
33
|
|
|
35
|
-
return get_key_manager(
|
|
34
|
+
return get_key_manager(ServerConfigManager.get_instance())
|
|
36
35
|
except ImportError:
|
|
37
36
|
# Fallback for standalone usage
|
|
38
37
|
return None
|
|
@@ -12,7 +12,7 @@ Architecture:
|
|
|
12
12
|
- state.py: Agent state management
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
|
-
from agent_server.langchain.agent import
|
|
15
|
+
from agent_server.langchain.agent import create_agent_system
|
|
16
16
|
from agent_server.langchain.state import AgentState
|
|
17
17
|
|
|
18
|
-
__all__ = ["
|
|
18
|
+
__all__ = ["create_agent_system", "AgentState"]
|