devsquad 3.6.0__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.
- devsquad-3.6.0.dist-info/METADATA +944 -0
- devsquad-3.6.0.dist-info/RECORD +95 -0
- devsquad-3.6.0.dist-info/WHEEL +5 -0
- devsquad-3.6.0.dist-info/entry_points.txt +2 -0
- devsquad-3.6.0.dist-info/licenses/LICENSE +21 -0
- devsquad-3.6.0.dist-info/top_level.txt +2 -0
- scripts/__init__.py +0 -0
- scripts/ai_semantic_matcher.py +512 -0
- scripts/alert_manager.py +505 -0
- scripts/api/__init__.py +43 -0
- scripts/api/models.py +386 -0
- scripts/api/routes/__init__.py +20 -0
- scripts/api/routes/dispatch.py +348 -0
- scripts/api/routes/lifecycle.py +330 -0
- scripts/api/routes/metrics_gates.py +347 -0
- scripts/api_server.py +318 -0
- scripts/auth.py +451 -0
- scripts/cli/__init__.py +1 -0
- scripts/cli/cli_visual.py +642 -0
- scripts/cli.py +1094 -0
- scripts/collaboration/__init__.py +212 -0
- scripts/collaboration/_version.py +1 -0
- scripts/collaboration/agent_briefing.py +656 -0
- scripts/collaboration/ai_semantic_matcher.py +260 -0
- scripts/collaboration/anchor_checker.py +281 -0
- scripts/collaboration/anti_rationalization.py +470 -0
- scripts/collaboration/async_integration_example.py +255 -0
- scripts/collaboration/batch_scheduler.py +149 -0
- scripts/collaboration/checkpoint_manager.py +561 -0
- scripts/collaboration/ci_feedback_adapter.py +351 -0
- scripts/collaboration/code_map_generator.py +247 -0
- scripts/collaboration/concern_pack_loader.py +352 -0
- scripts/collaboration/confidence_score.py +496 -0
- scripts/collaboration/config_loader.py +188 -0
- scripts/collaboration/consensus.py +244 -0
- scripts/collaboration/context_compressor.py +533 -0
- scripts/collaboration/coordinator.py +668 -0
- scripts/collaboration/dispatcher.py +1636 -0
- scripts/collaboration/dual_layer_context.py +128 -0
- scripts/collaboration/enhanced_worker.py +539 -0
- scripts/collaboration/feature_usage_tracker.py +206 -0
- scripts/collaboration/five_axis_consensus.py +334 -0
- scripts/collaboration/input_validator.py +401 -0
- scripts/collaboration/integration_example.py +287 -0
- scripts/collaboration/intent_workflow_mapper.py +350 -0
- scripts/collaboration/language_parsers.py +269 -0
- scripts/collaboration/lifecycle_protocol.py +1446 -0
- scripts/collaboration/llm_backend.py +453 -0
- scripts/collaboration/llm_cache.py +448 -0
- scripts/collaboration/llm_cache_async.py +347 -0
- scripts/collaboration/llm_retry.py +387 -0
- scripts/collaboration/llm_retry_async.py +389 -0
- scripts/collaboration/mce_adapter.py +597 -0
- scripts/collaboration/memory_bridge.py +1607 -0
- scripts/collaboration/models.py +537 -0
- scripts/collaboration/null_providers.py +297 -0
- scripts/collaboration/operation_classifier.py +289 -0
- scripts/collaboration/output_slicer.py +225 -0
- scripts/collaboration/performance_monitor.py +462 -0
- scripts/collaboration/permission_guard.py +865 -0
- scripts/collaboration/prompt_assembler.py +756 -0
- scripts/collaboration/prompt_variant_generator.py +483 -0
- scripts/collaboration/protocols.py +267 -0
- scripts/collaboration/report_formatter.py +352 -0
- scripts/collaboration/retrospective.py +279 -0
- scripts/collaboration/role_matcher.py +92 -0
- scripts/collaboration/role_template_market.py +352 -0
- scripts/collaboration/rule_collector.py +678 -0
- scripts/collaboration/scratchpad.py +346 -0
- scripts/collaboration/skill_registry.py +151 -0
- scripts/collaboration/skillifier.py +878 -0
- scripts/collaboration/standardized_role_template.py +317 -0
- scripts/collaboration/task_completion_checker.py +237 -0
- scripts/collaboration/test_quality_guard.py +695 -0
- scripts/collaboration/unified_gate_engine.py +598 -0
- scripts/collaboration/usage_tracker.py +309 -0
- scripts/collaboration/user_friendly_error.py +176 -0
- scripts/collaboration/verification_gate.py +312 -0
- scripts/collaboration/warmup_manager.py +635 -0
- scripts/collaboration/worker.py +513 -0
- scripts/collaboration/workflow_engine.py +684 -0
- scripts/dashboard.py +1088 -0
- scripts/generate_benchmark_report.py +786 -0
- scripts/history_manager.py +604 -0
- scripts/mcp_server.py +289 -0
- skills/__init__.py +32 -0
- skills/dispatch/handler.py +52 -0
- skills/intent/handler.py +59 -0
- skills/registry.py +67 -0
- skills/retrospective/__init__.py +0 -0
- skills/retrospective/handler.py +125 -0
- skills/review/handler.py +356 -0
- skills/security/handler.py +454 -0
- skills/test/__init__.py +0 -0
- skills/test/handler.py +78 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
DevSquad Collaboration Optimization Modules
|
|
5
|
+
|
|
6
|
+
This package provides three core optimization modules for LLM-based applications:
|
|
7
|
+
|
|
8
|
+
1. LLM Cache (llm_cache.py)
|
|
9
|
+
- Reduces API costs by 60-80%
|
|
10
|
+
- Improves response time by 90% on cache hits
|
|
11
|
+
- Supports TTL-based expiration and LRU eviction
|
|
12
|
+
|
|
13
|
+
2. LLM Retry & Fallback (llm_retry.py)
|
|
14
|
+
- Exponential backoff retry mechanism
|
|
15
|
+
- Multi-backend fallback support
|
|
16
|
+
- Circuit breaker pattern for fault tolerance
|
|
17
|
+
|
|
18
|
+
3. Performance Monitor (performance_monitor.py)
|
|
19
|
+
- Real-time performance tracking
|
|
20
|
+
- P95/P99 latency metrics
|
|
21
|
+
- Bottleneck detection and reporting
|
|
22
|
+
|
|
23
|
+
Quick Start:
|
|
24
|
+
from scripts.collaboration import (
|
|
25
|
+
get_llm_cache,
|
|
26
|
+
retry_with_fallback,
|
|
27
|
+
monitor_performance
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
@monitor_performance("my_function")
|
|
31
|
+
@retry_with_fallback(max_retries=3)
|
|
32
|
+
def my_function():
|
|
33
|
+
cache = get_llm_cache()
|
|
34
|
+
# Your code here
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
For detailed documentation, see: docs/OPTIMIZATION_GUIDE.md
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
# LLM Cache exports
|
|
41
|
+
from .llm_cache import (
|
|
42
|
+
LLMCache,
|
|
43
|
+
CacheEntry,
|
|
44
|
+
get_llm_cache,
|
|
45
|
+
reset_cache,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
# LLM Retry exports
|
|
49
|
+
from .llm_retry import (
|
|
50
|
+
LLMRetryManager,
|
|
51
|
+
RetryConfig,
|
|
52
|
+
CircuitBreakerState,
|
|
53
|
+
RateLimitError,
|
|
54
|
+
CircuitBreakerError,
|
|
55
|
+
get_retry_manager,
|
|
56
|
+
retry_with_fallback,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Performance Monitor exports
|
|
60
|
+
from .performance_monitor import (
|
|
61
|
+
PerformanceMonitor,
|
|
62
|
+
PerformanceMetric,
|
|
63
|
+
FunctionStats,
|
|
64
|
+
get_monitor,
|
|
65
|
+
monitor_performance,
|
|
66
|
+
reset_monitor,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# Collaboration Core exports
|
|
70
|
+
from .scratchpad import Scratchpad
|
|
71
|
+
from .worker import Worker, WorkerFactory
|
|
72
|
+
from .enhanced_worker import EnhancedWorker, AgentBriefingOutput
|
|
73
|
+
from .consensus import ConsensusEngine
|
|
74
|
+
from .coordinator import Coordinator
|
|
75
|
+
from .batch_scheduler import BatchScheduler
|
|
76
|
+
|
|
77
|
+
# Data models exports
|
|
78
|
+
from .models import (
|
|
79
|
+
EntryType,
|
|
80
|
+
EntryStatus,
|
|
81
|
+
ReferenceType,
|
|
82
|
+
Reference,
|
|
83
|
+
ScratchpadEntry,
|
|
84
|
+
TaskNotification,
|
|
85
|
+
TaskDefinition,
|
|
86
|
+
WorkerResult,
|
|
87
|
+
Vote,
|
|
88
|
+
DecisionProposal,
|
|
89
|
+
DecisionOutcome,
|
|
90
|
+
BatchMode,
|
|
91
|
+
TaskBatch,
|
|
92
|
+
ROLE_WEIGHTS,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
# V3.6.0 Module exports
|
|
96
|
+
from .anchor_checker import AnchorChecker
|
|
97
|
+
from .retrospective import RetrospectiveEngine
|
|
98
|
+
from .feature_usage_tracker import FeatureUsageTracker
|
|
99
|
+
from .dual_layer_context import DualLayerContextManager
|
|
100
|
+
from .intent_workflow_mapper import IntentWorkflowMapper
|
|
101
|
+
from .operation_classifier import OperationClassifier
|
|
102
|
+
from .skill_registry import SkillRegistry
|
|
103
|
+
from .ai_semantic_matcher import AISemanticMatcher
|
|
104
|
+
from .five_axis_consensus import FiveAxisConsensusEngine
|
|
105
|
+
from .null_providers import (
|
|
106
|
+
NullCacheProvider,
|
|
107
|
+
NullRetryProvider,
|
|
108
|
+
NullMonitorProvider,
|
|
109
|
+
NullMemoryProvider,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# Tier3 Auxiliary Module exports
|
|
113
|
+
from .output_slicer import OutputSlicer, OutputSlice
|
|
114
|
+
from .ci_feedback_adapter import CIFeedbackAdapter, CIResult, CIContext
|
|
115
|
+
from .standardized_role_template import StandardizedRoleTemplate
|
|
116
|
+
from .prompt_variant_generator import PromptVariantGenerator
|
|
117
|
+
from .role_template_market import RoleTemplateMarket
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
from ._version import __version__
|
|
121
|
+
__author__ = "DevSquad Team"
|
|
122
|
+
__all__ = [
|
|
123
|
+
# Cache
|
|
124
|
+
"LLMCache",
|
|
125
|
+
"CacheEntry",
|
|
126
|
+
"get_llm_cache",
|
|
127
|
+
"reset_cache",
|
|
128
|
+
# Retry
|
|
129
|
+
"LLMRetryManager",
|
|
130
|
+
"RetryConfig",
|
|
131
|
+
"CircuitBreakerState",
|
|
132
|
+
"RateLimitError",
|
|
133
|
+
"CircuitBreakerError",
|
|
134
|
+
"get_retry_manager",
|
|
135
|
+
"retry_with_fallback",
|
|
136
|
+
# Monitor
|
|
137
|
+
"PerformanceMonitor",
|
|
138
|
+
"PerformanceMetric",
|
|
139
|
+
"FunctionStats",
|
|
140
|
+
"get_monitor",
|
|
141
|
+
"monitor_performance",
|
|
142
|
+
"reset_monitor",
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def get_version() -> str:
|
|
147
|
+
"""Get the current version of the optimization modules."""
|
|
148
|
+
return __version__
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def print_stats():
|
|
152
|
+
"""Print statistics from all optimization modules."""
|
|
153
|
+
print("\n" + "="*60)
|
|
154
|
+
print("DevSquad Optimization Modules Statistics")
|
|
155
|
+
print("="*60)
|
|
156
|
+
|
|
157
|
+
# Cache stats
|
|
158
|
+
try:
|
|
159
|
+
cache = get_llm_cache()
|
|
160
|
+
cache_stats = cache.get_stats()
|
|
161
|
+
print("\n📦 Cache Statistics:")
|
|
162
|
+
print(f" Hit Rate: {cache_stats['hit_rate_percent']}")
|
|
163
|
+
print(f" Total Requests: {cache_stats['total_requests']}")
|
|
164
|
+
print(f" Memory Entries: {cache_stats['memory_entries']}")
|
|
165
|
+
print(f" Disk Entries: {cache_stats['disk_entries']}")
|
|
166
|
+
except Exception as e:
|
|
167
|
+
print(f"\n📦 Cache: Not initialized or error: {e}")
|
|
168
|
+
|
|
169
|
+
# Retry stats
|
|
170
|
+
try:
|
|
171
|
+
retry_manager = get_retry_manager()
|
|
172
|
+
retry_stats = retry_manager.get_stats()
|
|
173
|
+
print("\n🔄 Retry Statistics:")
|
|
174
|
+
print(f" Success Rate: {retry_stats['success_rate']}")
|
|
175
|
+
print(f" Total Calls: {retry_stats['total_calls']}")
|
|
176
|
+
print(f" Retries: {retry_stats['retries']}")
|
|
177
|
+
print(f" Fallbacks: {retry_stats['fallbacks']}")
|
|
178
|
+
except Exception as e:
|
|
179
|
+
print(f"\n🔄 Retry: Not initialized or error: {e}")
|
|
180
|
+
|
|
181
|
+
# Performance stats
|
|
182
|
+
try:
|
|
183
|
+
monitor = get_monitor()
|
|
184
|
+
perf_stats = monitor.get_stats()
|
|
185
|
+
print("\nâš¡ Performance Statistics:")
|
|
186
|
+
print(f" Uptime: {perf_stats['uptime_seconds']:.0f}s")
|
|
187
|
+
print(f" Total Metrics: {perf_stats['total_metrics']}")
|
|
188
|
+
print(f" Monitored Functions: {len(perf_stats['functions'])}")
|
|
189
|
+
except Exception as e:
|
|
190
|
+
print(f"\nâš¡ Performance: Not initialized or error: {e}")
|
|
191
|
+
|
|
192
|
+
print("\n" + "="*60)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def reset_all():
|
|
196
|
+
"""Reset all optimization modules (useful for testing)."""
|
|
197
|
+
reset_cache()
|
|
198
|
+
reset_monitor()
|
|
199
|
+
# Note: retry_manager doesn't have a reset function, but you can create a new instance
|
|
200
|
+
print("✓ All optimization modules reset")
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
# Module initialization message
|
|
204
|
+
def _init_message():
|
|
205
|
+
"""Print initialization message (only in debug mode)."""
|
|
206
|
+
import os
|
|
207
|
+
if os.getenv("DEVSQUAD_DEBUG"):
|
|
208
|
+
print(f"DevSquad Optimization Modules v{__version__} loaded")
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
# Auto-initialize on import (only in debug mode)
|
|
212
|
+
_init_message()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "3.6.0"
|