codebuff-agent 2.1.74__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.
- codebuff_agent-2.1.74.data/data/etc/jupyter/jupyter_server_config.d/codebuff_agent.json +7 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/package.json +157 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/104.2b8f20f9d1ac2c9db01b.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/150.39fa98117cc8ca590465.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/166.386ff9b2c37ac865fdee.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/216.25cf81131bf7274dabf4.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/353.581bd1cb00746399b62e.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/367.575f9621b63c9a641aa9.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/421.11dac223a2c2da1b09f5.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/432.8513b4c6cc1d1232d165.js +2 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/432.8513b4c6cc1d1232d165.js.LICENSE.txt +19 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/439.ba5b5ef70ec6de214b8c.js +2 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/439.ba5b5ef70ec6de214b8c.js.LICENSE.txt +8 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/481.cc2dec9fa869d66f1407.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/487.0796e931d6e651482c14.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/49.d326f554b6f9ccde6580.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/541.26897ea32845659e36be.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/579.e569d3edd8391fd8fbb3.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/58.eb7cc679f7535cc8a2f1.js +2 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/58.eb7cc679f7535cc8a2f1.js.LICENSE.txt +8 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/666.d9bfdb23f98489d0a188.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/677.d266c39dbed33bc388b3.js +2 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/677.d266c39dbed33bc388b3.js.LICENSE.txt +8 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/68.26b6f59c8454adb17f20.js +204 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/694.4ac443814260057e68f7.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/791.61affb8d3480d3d60e0d.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/848.4d2db09cfbb09374b299.js +2 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/848.4d2db09cfbb09374b299.js.LICENSE.txt +9 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/868.5cfe7e1a348ec5af1b8c.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/97.ea559a5b8a9a09f17c6b.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/remoteEntry.5292fc9c6df7e7920cc8.js +1 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/style.js +4 -0
- codebuff_agent-2.1.74.data/data/share/jupyter/labextensions/codebuff/static/third-party-licenses.json +724 -0
- codebuff_agent-2.1.74.dist-info/METADATA +142 -0
- codebuff_agent-2.1.74.dist-info/RECORD +217 -0
- codebuff_agent-2.1.74.dist-info/WHEEL +4 -0
- codebuff_agent-2.1.74.dist-info/licenses/LICENSE +21 -0
- codebuff_core/__init__.py +153 -0
- codebuff_core/codebuff_config_defaults.json +64 -0
- codebuff_core/core/__init__.py +35 -0
- codebuff_core/core/code_validator.py +1238 -0
- codebuff_core/core/error_classifier.py +579 -0
- codebuff_core/core/exceptions.py +49 -0
- codebuff_core/data/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4 +100256 -0
- codebuff_core/directory_policy.py +32 -0
- codebuff_core/factory.py +155 -0
- codebuff_core/interfaces.py +197 -0
- codebuff_core/knowledge/__init__.py +31 -0
- codebuff_core/knowledge/chunking.py +375 -0
- codebuff_core/knowledge/loader.py +339 -0
- codebuff_core/knowledge/watchdog_service.py +354 -0
- codebuff_core/legacy_paths.py +69 -0
- codebuff_core/llm/__init__.py +13 -0
- codebuff_core/llm/service.py +407 -0
- codebuff_core/managers/__init__.py +22 -0
- codebuff_core/managers/config_manager.py +690 -0
- codebuff_core/managers/remote_config.py +673 -0
- codebuff_core/managers/remote_skills.py +539 -0
- codebuff_core/managers/session_manager.py +255 -0
- codebuff_core/middleware/__init__.py +3 -0
- codebuff_core/middleware/error_recovery.py +394 -0
- codebuff_core/middleware/logging_utils.py +33 -0
- codebuff_core/models/__init__.py +111 -0
- codebuff_core/models/agent.py +306 -0
- codebuff_core/models/chat.py +57 -0
- codebuff_core/models/common.py +82 -0
- codebuff_core/models/rag.py +300 -0
- codebuff_core/platform_rules.py +127 -0
- codebuff_core/prompts/__init__.py +44 -0
- codebuff_core/prompts/auto_agent_prompts.py +1278 -0
- codebuff_core/services/__init__.py +30 -0
- codebuff_core/services/agent_service.py +345 -0
- codebuff_core/services/analytics_aggregate.py +837 -0
- codebuff_core/services/chat_service.py +898 -0
- codebuff_core/services/context_condenser.py +306 -0
- codebuff_core/services/pii_guardrail.py +393 -0
- codebuff_core/services/rag_chat_agent.py +2993 -0
- codebuff_core/services/rag_collections.py +2740 -0
- codebuff_core/services/rag_manager.py +890 -0
- codebuff_core/services/rag_service.py +145 -0
- codebuff_core/services/retriever.py +260 -0
- codebuff_core/services/vllm_embedding_service.py +290 -0
- codebuff_core/tests/__init__.py +1 -0
- codebuff_core/tests/conftest.py +81 -0
- codebuff_core/tests/test_error_recovery.py +647 -0
- codebuff_core/tests/test_factory.py +135 -0
- codebuff_core/tests/test_services.py +150 -0
- jupyter_ext/__init__.py +266 -0
- jupyter_ext/_version.py +4 -0
- jupyter_ext/agent/__init__.py +49 -0
- jupyter_ext/agent/agent_factory.py +2270 -0
- jupyter_ext/agent/ast_tools.py +451 -0
- jupyter_ext/agent/autofix_middleware.py +481 -0
- jupyter_ext/agent/background_procs.py +372 -0
- jupyter_ext/agent/code_history_middleware.py +211 -0
- jupyter_ext/agent/codex_autofix.py +160 -0
- jupyter_ext/agent/codex_bridge.py +3339 -0
- jupyter_ext/agent/codex_hooks.py +320 -0
- jupyter_ext/agent/codex_slash.py +685 -0
- jupyter_ext/agent/codex_threads.py +114 -0
- jupyter_ext/agent/content_injection.py +377 -0
- jupyter_ext/agent/continuation_middleware.py +548 -0
- jupyter_ext/agent/custom_skills.py +335 -0
- jupyter_ext/agent/file_diffs.py +99 -0
- jupyter_ext/agent/git_history.py +188 -0
- jupyter_ext/agent/guardrail_middleware.py +421 -0
- jupyter_ext/agent/json_repair_utils.py +54 -0
- jupyter_ext/agent/langchain_tools.py +2673 -0
- jupyter_ext/agent/mermaid_fixer.py +289 -0
- jupyter_ext/agent/mermaid_middleware.py +135 -0
- jupyter_ext/agent/middleware.py +359 -0
- jupyter_ext/agent/middleware_prompts.py +53 -0
- jupyter_ext/agent/observability.py +334 -0
- jupyter_ext/agent/patch_tool_calls.py +57 -0
- jupyter_ext/agent/prompts.py +112 -0
- jupyter_ext/agent/skill_middleware.py +257 -0
- jupyter_ext/agent/skills/airflow_dag_development.md +36 -0
- jupyter_ext/agent/skills/anomaly_detection.md +12 -0
- jupyter_ext/agent/skills/athena_sql.md +156 -0
- jupyter_ext/agent/skills/bdp_table_search.md +33 -0
- jupyter_ext/agent/skills/bigquery.md +65 -0
- jupyter_ext/agent/skills/bigquery_oracle.md +231 -0
- jupyter_ext/agent/skills/bigquery_tuning.md +307 -0
- jupyter_ext/agent/skills/classification_evaluation.md +11 -0
- jupyter_ext/agent/skills/clustering_analysis.md +12 -0
- jupyter_ext/agent/skills/comprehensive_eda.md +11 -0
- jupyter_ext/agent/skills/data_analysis.md +236 -0
- jupyter_ext/agent/skills/data_cleaning_pipeline.md +12 -0
- jupyter_ext/agent/skills/data_loading.md +158 -0
- jupyter_ext/agent/skills/data_quality_report.md +13 -0
- jupyter_ext/agent/skills/dimensionality_reduction.md +12 -0
- jupyter_ext/agent/skills/emr_script_development.md +17 -0
- jupyter_ext/agent/skills/experiment_tracking.md +13 -0
- jupyter_ext/agent/skills/feature_importance_analysis.md +10 -0
- jupyter_ext/agent/skills/hyperparameter_tuning.md +12 -0
- jupyter_ext/agent/skills/hypothesis_testing.md +12 -0
- jupyter_ext/agent/skills/imbalanced_data_handling.md +12 -0
- jupyter_ext/agent/skills/inference.md +392 -0
- jupyter_ext/agent/skills/lambda_function_development.md +19 -0
- jupyter_ext/agent/skills/model_comparison.md +11 -0
- jupyter_ext/agent/skills/model_explainability.md +12 -0
- jupyter_ext/agent/skills/model_training.md +318 -0
- jupyter_ext/agent/skills/pyspark.md +352 -0
- jupyter_ext/agent/skills/python_code_quality.md +35 -0
- jupyter_ext/agent/skills/regression_evaluation.md +12 -0
- jupyter_ext/agent/skills/spring_java_development.md +35 -0
- jupyter_ext/agent/skills/text_preprocessing.md +12 -0
- jupyter_ext/agent/skills/time_series_analysis.md +13 -0
- jupyter_ext/agent/skills/unit_testing.md +203 -0
- jupyter_ext/agent/todo_prompts.py +57 -0
- jupyter_ext/agent/tool_report.py +45 -0
- jupyter_ext/analytics_ingest.py +599 -0
- jupyter_ext/etc/jupyter/jupyter_server_config.d/codebuff_agent.json +7 -0
- jupyter_ext/handlers/__init__.py +8 -0
- jupyter_ext/handlers/analytics_handler.py +170 -0
- jupyter_ext/handlers/benchmark_handler.py +794 -0
- jupyter_ext/handlers/eda_benchmark_handler.py +1328 -0
- jupyter_ext/handlers/rag_admin_handler.py +689 -0
- jupyter_ext/handlers/websocket.py +497 -0
- jupyter_ext/http_handlers.py +8744 -0
- jupyter_ext/idle_monitor.py +346 -0
- jupyter_ext/labextension/package.json +157 -0
- jupyter_ext/labextension/static/104.2b8f20f9d1ac2c9db01b.js +1 -0
- jupyter_ext/labextension/static/150.39fa98117cc8ca590465.js +1 -0
- jupyter_ext/labextension/static/166.386ff9b2c37ac865fdee.js +1 -0
- jupyter_ext/labextension/static/216.25cf81131bf7274dabf4.js +1 -0
- jupyter_ext/labextension/static/353.581bd1cb00746399b62e.js +1 -0
- jupyter_ext/labextension/static/367.575f9621b63c9a641aa9.js +1 -0
- jupyter_ext/labextension/static/421.11dac223a2c2da1b09f5.js +1 -0
- jupyter_ext/labextension/static/432.8513b4c6cc1d1232d165.js +2 -0
- jupyter_ext/labextension/static/432.8513b4c6cc1d1232d165.js.LICENSE.txt +19 -0
- jupyter_ext/labextension/static/439.ba5b5ef70ec6de214b8c.js +2 -0
- jupyter_ext/labextension/static/439.ba5b5ef70ec6de214b8c.js.LICENSE.txt +8 -0
- jupyter_ext/labextension/static/481.cc2dec9fa869d66f1407.js +1 -0
- jupyter_ext/labextension/static/487.0796e931d6e651482c14.js +1 -0
- jupyter_ext/labextension/static/49.d326f554b6f9ccde6580.js +1 -0
- jupyter_ext/labextension/static/541.26897ea32845659e36be.js +1 -0
- jupyter_ext/labextension/static/579.e569d3edd8391fd8fbb3.js +1 -0
- jupyter_ext/labextension/static/58.eb7cc679f7535cc8a2f1.js +2 -0
- jupyter_ext/labextension/static/58.eb7cc679f7535cc8a2f1.js.LICENSE.txt +8 -0
- jupyter_ext/labextension/static/666.d9bfdb23f98489d0a188.js +1 -0
- jupyter_ext/labextension/static/677.d266c39dbed33bc388b3.js +2 -0
- jupyter_ext/labextension/static/677.d266c39dbed33bc388b3.js.LICENSE.txt +8 -0
- jupyter_ext/labextension/static/68.26b6f59c8454adb17f20.js +204 -0
- jupyter_ext/labextension/static/694.4ac443814260057e68f7.js +1 -0
- jupyter_ext/labextension/static/791.61affb8d3480d3d60e0d.js +1 -0
- jupyter_ext/labextension/static/848.4d2db09cfbb09374b299.js +2 -0
- jupyter_ext/labextension/static/848.4d2db09cfbb09374b299.js.LICENSE.txt +9 -0
- jupyter_ext/labextension/static/868.5cfe7e1a348ec5af1b8c.js +1 -0
- jupyter_ext/labextension/static/97.ea559a5b8a9a09f17c6b.js +1 -0
- jupyter_ext/labextension/static/remoteEntry.5292fc9c6df7e7920cc8.js +1 -0
- jupyter_ext/labextension/static/style.js +4 -0
- jupyter_ext/labextension/static/third-party-licenses.json +724 -0
- jupyter_ext/log_paths.py +113 -0
- jupyter_ext/resource_usage.py +519 -0
- jupyter_ext/secrets_bootstrap.py +116 -0
- jupyter_ext/team_access.py +105 -0
- jupyter_ext/tests/__init__.py +1 -0
- jupyter_ext/tests/test_context.py +234 -0
- jupyter_ext/tests/test_factory.py +563 -0
- jupyter_ext/tests/test_file_finder.py +139 -0
- jupyter_ext/tests/test_handlers.py +58 -0
- jupyter_ext/tests/test_mcp_selftest.py +204 -0
- jupyter_ext/tests/test_mermaid_fixer.py +272 -0
- jupyter_ext/tests/test_resource_tiers.py +298 -0
- jupyter_ext/tools/__init__.py +15 -0
- jupyter_ext/tools/base.py +90 -0
- jupyter_ext/tools/context.py +268 -0
- jupyter_ext/tools/dir_complete.py +86 -0
- jupyter_ext/tools/file_finder.py +303 -0
- jupyter_ext/tools/file_tools.py +244 -0
- jupyter_ext/tools/jupyter_tools.py +296 -0
- jupyter_ext/tools/registry.py +159 -0
- jupyter_ext/tools/search_tools.py +230 -0
- jupyter_ext/tools/security_tools.py +657 -0
- jupyter_ext/tools/shell_tools.py +109 -0
- jupyter_ext/tools/user_tools.py +132 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Codebuff Core - Pydantic Models
|
|
3
|
+
|
|
4
|
+
Shared data models for the Codebuff system.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .agent import (
|
|
8
|
+
DependencyInfo,
|
|
9
|
+
ExecutionPlan,
|
|
10
|
+
PlanRequest,
|
|
11
|
+
PlanResponse,
|
|
12
|
+
PlanStep,
|
|
13
|
+
RefineRequest,
|
|
14
|
+
RefineResponse,
|
|
15
|
+
ReflectionAdjustment,
|
|
16
|
+
ReflectionAnalysis,
|
|
17
|
+
ReflectionEvaluation,
|
|
18
|
+
ReflectionImpact,
|
|
19
|
+
ReflectionRecommendations,
|
|
20
|
+
ReflectionResult,
|
|
21
|
+
ReflectRequest,
|
|
22
|
+
ReflectResponse,
|
|
23
|
+
ReplanRequest,
|
|
24
|
+
ReplanResponse,
|
|
25
|
+
ReportExecutionRequest,
|
|
26
|
+
ReportExecutionResponse,
|
|
27
|
+
ValidateRequest,
|
|
28
|
+
ValidateResponse,
|
|
29
|
+
ValidationIssue,
|
|
30
|
+
VerifyStateRequest,
|
|
31
|
+
VerifyStateResponse,
|
|
32
|
+
)
|
|
33
|
+
from .chat import (
|
|
34
|
+
ChatRequest,
|
|
35
|
+
ChatResponse,
|
|
36
|
+
StreamChunk,
|
|
37
|
+
)
|
|
38
|
+
from .common import (
|
|
39
|
+
APIResponse,
|
|
40
|
+
ErrorInfo,
|
|
41
|
+
LLMConfig,
|
|
42
|
+
NotebookContext,
|
|
43
|
+
ToolCall,
|
|
44
|
+
VLLMConfig,
|
|
45
|
+
)
|
|
46
|
+
from .rag import (
|
|
47
|
+
ChunkingConfig,
|
|
48
|
+
EmbeddingConfig,
|
|
49
|
+
IndexStatusResponse,
|
|
50
|
+
QdrantConfig,
|
|
51
|
+
RAGConfig,
|
|
52
|
+
ReindexRequest,
|
|
53
|
+
ReindexResponse,
|
|
54
|
+
SearchRequest,
|
|
55
|
+
SearchResponse,
|
|
56
|
+
SearchResult,
|
|
57
|
+
WatchdogConfig,
|
|
58
|
+
get_default_rag_config,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
__all__ = [
|
|
62
|
+
# Common
|
|
63
|
+
"APIResponse",
|
|
64
|
+
"ErrorInfo",
|
|
65
|
+
"LLMConfig",
|
|
66
|
+
"NotebookContext",
|
|
67
|
+
"ToolCall",
|
|
68
|
+
"VLLMConfig",
|
|
69
|
+
# Agent
|
|
70
|
+
"DependencyInfo",
|
|
71
|
+
"ExecutionPlan",
|
|
72
|
+
"PlanRequest",
|
|
73
|
+
"PlanResponse",
|
|
74
|
+
"PlanStep",
|
|
75
|
+
"RefineRequest",
|
|
76
|
+
"RefineResponse",
|
|
77
|
+
"ReflectRequest",
|
|
78
|
+
"ReflectResponse",
|
|
79
|
+
"ReflectionAdjustment",
|
|
80
|
+
"ReflectionAnalysis",
|
|
81
|
+
"ReflectionEvaluation",
|
|
82
|
+
"ReflectionImpact",
|
|
83
|
+
"ReflectionRecommendations",
|
|
84
|
+
"ReflectionResult",
|
|
85
|
+
"ReplanRequest",
|
|
86
|
+
"ReplanResponse",
|
|
87
|
+
"ReportExecutionRequest",
|
|
88
|
+
"ReportExecutionResponse",
|
|
89
|
+
"ValidateRequest",
|
|
90
|
+
"ValidateResponse",
|
|
91
|
+
"ValidationIssue",
|
|
92
|
+
"VerifyStateRequest",
|
|
93
|
+
"VerifyStateResponse",
|
|
94
|
+
# Chat
|
|
95
|
+
"ChatRequest",
|
|
96
|
+
"ChatResponse",
|
|
97
|
+
"StreamChunk",
|
|
98
|
+
# RAG
|
|
99
|
+
"ChunkingConfig",
|
|
100
|
+
"EmbeddingConfig",
|
|
101
|
+
"IndexStatusResponse",
|
|
102
|
+
"QdrantConfig",
|
|
103
|
+
"RAGConfig",
|
|
104
|
+
"ReindexRequest",
|
|
105
|
+
"ReindexResponse",
|
|
106
|
+
"SearchRequest",
|
|
107
|
+
"SearchResponse",
|
|
108
|
+
"SearchResult",
|
|
109
|
+
"WatchdogConfig",
|
|
110
|
+
"get_default_rag_config",
|
|
111
|
+
]
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"""
|
|
2
|
+
에이전트 API Pydantic 모델
|
|
3
|
+
|
|
4
|
+
계획 생성, 개선, 재계획, 상태 검증을 위한 모델.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Any, Dict, List, Optional
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, Field
|
|
10
|
+
|
|
11
|
+
from .common import ErrorInfo, LLMConfig, NotebookContext, ToolCall
|
|
12
|
+
|
|
13
|
+
# ============ 계획 요청/응답 ============
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PlanStep(BaseModel):
|
|
17
|
+
"""실행 계획의 단일 단계"""
|
|
18
|
+
|
|
19
|
+
stepNumber: int = Field(description="단계 번호 (1부터 시작)")
|
|
20
|
+
description: str = Field(description="사람이 읽을 수 있는 단계 설명")
|
|
21
|
+
toolCalls: List[ToolCall] = Field(
|
|
22
|
+
default_factory=list, description="이 단계에서 실행할 도구들"
|
|
23
|
+
)
|
|
24
|
+
expectedOutput: Optional[str] = Field(default=None, description="예상 출력 설명")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ExecutionPlan(BaseModel):
|
|
28
|
+
"""에이전트가 생성한 실행 계획"""
|
|
29
|
+
|
|
30
|
+
goal: str = Field(description="전체 목표 설명")
|
|
31
|
+
totalSteps: int = Field(description="총 단계 수")
|
|
32
|
+
steps: List[PlanStep] = Field(description="순서대로 정렬된 실행 단계 목록")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class PlanRequest(BaseModel):
|
|
36
|
+
"""계획 생성 요청 본문"""
|
|
37
|
+
|
|
38
|
+
request: str = Field(description="사용자의 자연어 요청")
|
|
39
|
+
notebookContext: NotebookContext = Field(
|
|
40
|
+
default_factory=NotebookContext, description="현재 노트북 상태"
|
|
41
|
+
)
|
|
42
|
+
llmConfig: Optional[LLMConfig] = Field(
|
|
43
|
+
default=None, description="API 키가 포함된 LLM 설정 (클라이언트 제공)"
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class PlanResponse(BaseModel):
|
|
48
|
+
"""계획 생성 응답 본문"""
|
|
49
|
+
|
|
50
|
+
plan: ExecutionPlan = Field(description="생성된 실행 계획")
|
|
51
|
+
reasoning: str = Field(default="", description="에이전트의 추론 설명")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# ============ 개선 요청/응답 ============
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class RefineRequest(BaseModel):
|
|
58
|
+
"""코드 개선 요청 본문"""
|
|
59
|
+
|
|
60
|
+
step: Dict[str, Any] = Field(description="개선 중인 현재 단계")
|
|
61
|
+
error: ErrorInfo = Field(description="개선을 트리거한 오류")
|
|
62
|
+
attempt: int = Field(default=1, description="현재 시도 횟수")
|
|
63
|
+
previousCode: Optional[str] = Field(default=None, description="이전에 실행한 코드")
|
|
64
|
+
llmConfig: Optional[LLMConfig] = Field(
|
|
65
|
+
default=None, description="API 키가 포함된 LLM 설정 (클라이언트 제공)"
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class RefineResponse(BaseModel):
|
|
70
|
+
"""코드 개선 응답 본문"""
|
|
71
|
+
|
|
72
|
+
toolCalls: List[ToolCall] = Field(description="개선된 도구 호출")
|
|
73
|
+
reasoning: str = Field(default="", description="개선 추론")
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# ============ 재계획 요청/응답 ============
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class ReplanRequest(BaseModel):
|
|
80
|
+
"""재계획 요청 본문"""
|
|
81
|
+
|
|
82
|
+
originalPlan: ExecutionPlan = Field(description="원래 실행 계획")
|
|
83
|
+
currentStepIndex: int = Field(description="실패한 단계의 인덱스")
|
|
84
|
+
error: ErrorInfo = Field(description="재계획을 트리거한 오류")
|
|
85
|
+
executionHistory: List[Dict[str, Any]] = Field(
|
|
86
|
+
default_factory=list, description="실행된 단계 이력"
|
|
87
|
+
)
|
|
88
|
+
# LLM 폴백 관련 필드
|
|
89
|
+
previousAttempts: int = Field(
|
|
90
|
+
default=0, description="동일 오류에 대한 이전 시도 횟수"
|
|
91
|
+
)
|
|
92
|
+
previousCodes: List[str] = Field(
|
|
93
|
+
default_factory=list, description="이전에 시도한 코드들"
|
|
94
|
+
)
|
|
95
|
+
useLlmFallback: bool = Field(
|
|
96
|
+
default=True,
|
|
97
|
+
description="패턴 매칭 실패시 LLM 폴백 사용 여부",
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class ReplanResponse(BaseModel):
|
|
102
|
+
"""재계획 응답 본문"""
|
|
103
|
+
|
|
104
|
+
decision: str = Field(
|
|
105
|
+
description="재계획 결정 유형 (refine/insert_steps/replace_step/replan_remaining)"
|
|
106
|
+
)
|
|
107
|
+
analysis: Dict[str, Any] = Field(description="오류 분석 세부사항")
|
|
108
|
+
reasoning: str = Field(default="", description="재계획 추론")
|
|
109
|
+
changes: Dict[str, Any] = Field(default_factory=dict, description="제안된 변경사항")
|
|
110
|
+
usedLlm: bool = Field(
|
|
111
|
+
default=False, description="오류 분석에 LLM 폴백을 사용했는지 여부"
|
|
112
|
+
)
|
|
113
|
+
confidence: float = Field(
|
|
114
|
+
default=1.0,
|
|
115
|
+
description="분석 신뢰도 (패턴 매칭은 1.0, LLM은 0.0-1.0)",
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
# ============ 반성 요청/응답 ============
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class ReflectionEvaluation(BaseModel):
|
|
123
|
+
"""반성 평가 결과"""
|
|
124
|
+
|
|
125
|
+
checkpoint_passed: bool = Field(description="체크포인트 기준 통과 여부")
|
|
126
|
+
output_matches_expected: bool = Field(
|
|
127
|
+
description="출력이 예상 결과와 일치하는지 여부"
|
|
128
|
+
)
|
|
129
|
+
confidence_score: float = Field(description="신뢰도 점수 (0.0-1.0)")
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class ReflectionAnalysis(BaseModel):
|
|
133
|
+
"""반성 분석 세부사항"""
|
|
134
|
+
|
|
135
|
+
success_factors: List[str] = Field(
|
|
136
|
+
default_factory=list, description="성공에 기여한 요소들"
|
|
137
|
+
)
|
|
138
|
+
failure_factors: List[str] = Field(
|
|
139
|
+
default_factory=list, description="실패를 야기한 요소들"
|
|
140
|
+
)
|
|
141
|
+
unexpected_outcomes: List[str] = Field(
|
|
142
|
+
default_factory=list, description="예상치 못한 결과들"
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class ReflectionImpact(BaseModel):
|
|
147
|
+
"""나머지 단계에 대한 영향"""
|
|
148
|
+
|
|
149
|
+
affected_steps: List[int] = Field(
|
|
150
|
+
default_factory=list, description="영향받는 단계 번호들"
|
|
151
|
+
)
|
|
152
|
+
severity: str = Field(description="영향 심각도: none, minor, major, critical")
|
|
153
|
+
description: str = Field(description="영향 설명")
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class ReflectionAdjustment(BaseModel):
|
|
157
|
+
"""권장 조정사항"""
|
|
158
|
+
|
|
159
|
+
step_number: int = Field(description="조정할 단계 번호")
|
|
160
|
+
change_type: str = Field(
|
|
161
|
+
description="변경 유형: modify_code, add_step, remove_step, change_approach"
|
|
162
|
+
)
|
|
163
|
+
description: str = Field(description="조정 설명")
|
|
164
|
+
new_content: Optional[str] = Field(
|
|
165
|
+
default=None, description="해당되는 경우 새 콘텐츠"
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class ReflectionRecommendations(BaseModel):
|
|
170
|
+
"""반성 권장사항"""
|
|
171
|
+
|
|
172
|
+
action: str = Field(description="권장 작업: continue, adjust, retry, replan")
|
|
173
|
+
adjustments: List[ReflectionAdjustment] = Field(
|
|
174
|
+
default_factory=list, description="구체적인 조정사항들"
|
|
175
|
+
)
|
|
176
|
+
reasoning: str = Field(description="권장사항에 대한 추론")
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class ReflectionResult(BaseModel):
|
|
180
|
+
"""완전한 반성 결과"""
|
|
181
|
+
|
|
182
|
+
evaluation: ReflectionEvaluation = Field(description="평가 결과")
|
|
183
|
+
analysis: ReflectionAnalysis = Field(description="분석 세부사항")
|
|
184
|
+
impact_on_remaining: ReflectionImpact = Field(description="나머지 단계에 대한 영향")
|
|
185
|
+
recommendations: ReflectionRecommendations = Field(description="권장사항")
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class ReflectRequest(BaseModel):
|
|
189
|
+
"""단계 반성 요청 본문"""
|
|
190
|
+
|
|
191
|
+
stepNumber: int = Field(description="반성 대상 단계 번호")
|
|
192
|
+
stepDescription: str = Field(description="단계 설명")
|
|
193
|
+
executedCode: str = Field(description="실행된 코드")
|
|
194
|
+
executionStatus: str = Field(description="실행 상태 (success/error/warning)")
|
|
195
|
+
executionOutput: str = Field(description="실행 출력")
|
|
196
|
+
errorMessage: Optional[str] = Field(
|
|
197
|
+
default=None, description="있는 경우 오류 메시지"
|
|
198
|
+
)
|
|
199
|
+
expectedOutcome: Optional[str] = Field(default=None, description="예상 결과 설명")
|
|
200
|
+
validationCriteria: Optional[List[str]] = Field(
|
|
201
|
+
default=None, description="검증 기준"
|
|
202
|
+
)
|
|
203
|
+
remainingSteps: Optional[List[Dict[str, Any]]] = Field(
|
|
204
|
+
default=None, description="계획의 나머지 단계들"
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class ReflectResponse(BaseModel):
|
|
209
|
+
"""단계 반성 응답 본문"""
|
|
210
|
+
|
|
211
|
+
reflection: ReflectionResult = Field(description="반성 분석 결과")
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
# ============ 상태 검증 ============
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class VerifyStateRequest(BaseModel):
|
|
218
|
+
"""상태 검증 요청 본문"""
|
|
219
|
+
|
|
220
|
+
stepIndex: int = Field(description="검증할 단계 인덱스")
|
|
221
|
+
expectedChanges: Dict[str, Any] = Field(description="단계에서 예상되는 상태 변경")
|
|
222
|
+
actualOutput: str = Field(description="실행의 실제 출력")
|
|
223
|
+
executionResult: Dict[str, Any] = Field(description="전체 실행 결과")
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
class VerifyStateResponse(BaseModel):
|
|
227
|
+
"""상태 검증 응답 본문"""
|
|
228
|
+
|
|
229
|
+
verified: bool = Field(description="상태가 예상과 일치하는지 여부")
|
|
230
|
+
discrepancies: List[str] = Field(
|
|
231
|
+
default_factory=list, description="발견된 불일치 목록"
|
|
232
|
+
)
|
|
233
|
+
confidence: float = Field(default=0.0, description="신뢰도 점수 (0.0-1.0)")
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
# ============ 실행 보고 ============
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
class ReportExecutionRequest(BaseModel):
|
|
240
|
+
"""도구 실행 결과 보고 요청 본문"""
|
|
241
|
+
|
|
242
|
+
stepId: str = Field(description="단계 식별자")
|
|
243
|
+
result: Dict[str, Any] = Field(description="실행 결과 세부사항")
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
class ReportExecutionResponse(BaseModel):
|
|
247
|
+
"""실행 보고 응답 본문"""
|
|
248
|
+
|
|
249
|
+
acknowledged: bool = Field(default=True)
|
|
250
|
+
nextAction: Optional[str] = Field(default=None, description="제안된 다음 작업")
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
# ============ 코드 검증 ============
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
class ValidationIssue(BaseModel):
|
|
257
|
+
"""코드 검증 이슈 (구문, 미정의 이름 등)"""
|
|
258
|
+
|
|
259
|
+
severity: str = Field(description="이슈 심각도: error, warning, info")
|
|
260
|
+
category: str = Field(
|
|
261
|
+
description="이슈 카테고리: syntax, undefined_name, unused_import, unused_variable, redefined, import_error, type_error"
|
|
262
|
+
)
|
|
263
|
+
message: str = Field(description="이슈 설명")
|
|
264
|
+
line: Optional[int] = Field(default=None, description="줄 번호")
|
|
265
|
+
column: Optional[int] = Field(default=None, description="열 번호")
|
|
266
|
+
code_snippet: Optional[str] = Field(default=None, description="코드 스니펫")
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
class DependencyInfo(BaseModel):
|
|
270
|
+
"""코드 의존성 정보"""
|
|
271
|
+
|
|
272
|
+
imports: List[str] = Field(default_factory=list, description="import 문")
|
|
273
|
+
from_imports: Dict[str, List[str]] = Field(
|
|
274
|
+
default_factory=dict, description="from-import 문"
|
|
275
|
+
)
|
|
276
|
+
defined_names: List[str] = Field(
|
|
277
|
+
default_factory=list, description="정의된 변수/함수 이름"
|
|
278
|
+
)
|
|
279
|
+
used_names: List[str] = Field(
|
|
280
|
+
default_factory=list, description="사용된 변수/함수 이름"
|
|
281
|
+
)
|
|
282
|
+
undefined_names: List[str] = Field(
|
|
283
|
+
default_factory=list, description="미정의 이름 (잠재적 오류)"
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
class ValidateRequest(BaseModel):
|
|
288
|
+
"""코드 검증 요청 본문"""
|
|
289
|
+
|
|
290
|
+
code: str = Field(description="검증할 코드")
|
|
291
|
+
notebookContext: Optional[NotebookContext] = Field(
|
|
292
|
+
default=None, description="현재 노트북 컨텍스트 (변수/import 추적용)"
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class ValidateResponse(BaseModel):
|
|
297
|
+
"""코드 검증 응답 본문"""
|
|
298
|
+
|
|
299
|
+
valid: bool = Field(description="코드가 유효한지 여부 (오류 없음)")
|
|
300
|
+
issues: List[ValidationIssue] = Field(default_factory=list, description="검증 이슈")
|
|
301
|
+
dependencies: Optional[DependencyInfo] = Field(
|
|
302
|
+
default=None, description="코드 의존성"
|
|
303
|
+
)
|
|
304
|
+
hasErrors: bool = Field(description="오류가 있는지 여부")
|
|
305
|
+
hasWarnings: bool = Field(description="경고가 있는지 여부")
|
|
306
|
+
summary: str = Field(description="검증 요약")
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""
|
|
2
|
+
채팅 API Pydantic 모델
|
|
3
|
+
|
|
4
|
+
채팅 메시지 요청 및 응답을 위한 모델.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Optional
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, Field
|
|
10
|
+
|
|
11
|
+
from .common import LLMConfig
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ChatRequest(BaseModel):
|
|
15
|
+
"""채팅 메시지 요청 본문"""
|
|
16
|
+
|
|
17
|
+
message: str = Field(description="사용자의 채팅 메시지")
|
|
18
|
+
conversationId: Optional[str] = Field(
|
|
19
|
+
default=None, description="컨텍스트 연속성을 위한 대화 ID"
|
|
20
|
+
)
|
|
21
|
+
llmConfig: Optional[LLMConfig] = Field(
|
|
22
|
+
default=None, description="API 키가 포함된 LLM 설정 (클라이언트 제공)"
|
|
23
|
+
)
|
|
24
|
+
maxTokens: Optional[int] = Field(
|
|
25
|
+
default=None,
|
|
26
|
+
description="LLM 최대 출력 토큰 수 (미지정 시 기본값 4096)",
|
|
27
|
+
)
|
|
28
|
+
chatMode: Optional[str] = Field(
|
|
29
|
+
default=None,
|
|
30
|
+
description="채팅 모드: 'simple'(도구 없음), 'knowledge'(사내 검색 도구). jupyter_ext 의 Chat 핸들러가 BDP Q&A 가용 여부로 채운다(#183). ChatService 를 직접 부르면 simple 외에는 knowledge 로 돈다.",
|
|
31
|
+
)
|
|
32
|
+
workspaceRoot: Optional[str] = Field(
|
|
33
|
+
default=None,
|
|
34
|
+
description="`@<경로>` 파일 멘션을 풀 기준 디렉터리. jupyter_ext 의 Chat 핸들러가 채운다(#259). 없으면 서버 cwd.",
|
|
35
|
+
)
|
|
36
|
+
fileMentions: bool = Field(
|
|
37
|
+
default=True,
|
|
38
|
+
description="`@<경로>` 멘션을 풀지 여부. 셀 버튼·`/review`·노트북 첨부처럼 앱이 만든 프롬프트는 False 다 — 코드 속 `@decorator` 를 파일로 읽지 않는다(#259).",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class ChatResponse(BaseModel):
|
|
43
|
+
"""채팅 메시지 응답 본문"""
|
|
44
|
+
|
|
45
|
+
response: str = Field(description="어시스턴트의 응답")
|
|
46
|
+
conversationId: str = Field(description="이후 메시지를 위한 대화 ID")
|
|
47
|
+
model: Optional[str] = Field(default=None, description="응답에 사용된 모델")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class StreamChunk(BaseModel):
|
|
51
|
+
"""스트리밍 응답의 단일 청크"""
|
|
52
|
+
|
|
53
|
+
content: str = Field(description="부분 콘텐츠")
|
|
54
|
+
done: bool = Field(default=False, description="스트리밍 완료 여부")
|
|
55
|
+
conversationId: Optional[str] = Field(
|
|
56
|
+
default=None, description="대화 ID (마지막 청크에서 전송)"
|
|
57
|
+
)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Codebuff Core 공통 Pydantic 모델
|
|
3
|
+
|
|
4
|
+
모든 에이전트 서비스에서 사용되는 공유 데이터 모델.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Any, Dict, List, Optional
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ToolCall(BaseModel):
|
|
13
|
+
"""도구 호출 명세"""
|
|
14
|
+
|
|
15
|
+
tool: str = Field(description="도구 이름 (예: 'jupyter_cell', 'file_operation')")
|
|
16
|
+
parameters: Dict[str, Any] = Field(
|
|
17
|
+
default_factory=dict, description="도구 매개변수"
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ErrorInfo(BaseModel):
|
|
22
|
+
"""오류 정보 구조"""
|
|
23
|
+
|
|
24
|
+
type: str = Field(default="runtime", description="오류 유형")
|
|
25
|
+
message: str = Field(default="", description="오류 메시지")
|
|
26
|
+
traceback: Optional[List[str]] = Field(
|
|
27
|
+
default=None, description="스택 트레이스 라인"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class NotebookContext(BaseModel):
|
|
32
|
+
"""노트북 실행 컨텍스트"""
|
|
33
|
+
|
|
34
|
+
cellCount: int = Field(default=0, description="노트북의 셀 수")
|
|
35
|
+
importedLibraries: List[str] = Field(
|
|
36
|
+
default_factory=list, description="이미 import된 라이브러리"
|
|
37
|
+
)
|
|
38
|
+
definedVariables: List[str] = Field(
|
|
39
|
+
default_factory=list, description="현재 정의된 변수"
|
|
40
|
+
)
|
|
41
|
+
recentCells: List[Dict[str, Any]] = Field(
|
|
42
|
+
default_factory=list, description="최근 셀 내용과 출력"
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class APIResponse(BaseModel):
|
|
47
|
+
"""일반 API 응답 래퍼"""
|
|
48
|
+
|
|
49
|
+
success: bool = Field(default=True)
|
|
50
|
+
message: Optional[str] = None
|
|
51
|
+
data: Optional[Dict[str, Any]] = None
|
|
52
|
+
error: Optional[str] = None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# ============ LLM 설정 (클라이언트 제공) ============
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class VLLMConfig(BaseModel):
|
|
59
|
+
"""vLLM 프로바이더 설정"""
|
|
60
|
+
|
|
61
|
+
endpoint: str = Field(
|
|
62
|
+
default="http://localhost:8000", description="vLLM 엔드포인트"
|
|
63
|
+
)
|
|
64
|
+
apiKey: Optional[str] = Field(default=None, description="선택적 API 키")
|
|
65
|
+
model: str = Field(default="default", description="모델 이름")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class LLMConfig(BaseModel):
|
|
69
|
+
"""
|
|
70
|
+
클라이언트가 제공하는 LLM 설정.
|
|
71
|
+
API 키는 클라이언트 측에서 관리되며 각 요청과 함께 전달됩니다.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
75
|
+
|
|
76
|
+
provider: str = Field(default="vllm", description="LLM 프로바이더 (vllm)")
|
|
77
|
+
vllm: Optional[VLLMConfig] = Field(default=None, description="vLLM 설정")
|
|
78
|
+
system_prompt: Optional[str] = Field(
|
|
79
|
+
default=None,
|
|
80
|
+
alias="systemPrompt",
|
|
81
|
+
description="LangChain 시스템 프롬프트 오버라이드",
|
|
82
|
+
)
|