repodna-engine 1.0.1__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.
- repodna/__init__.py +3 -0
- repodna/__main__.py +10 -0
- repodna/advisor/__init__.py +17 -0
- repodna/advisor/engine.py +502 -0
- repodna/advisor/models.py +101 -0
- repodna/agent/__init__.py +87 -0
- repodna/agent/context.py +558 -0
- repodna/agent/deltas.py +198 -0
- repodna/agent/evidence.py +134 -0
- repodna/agent/expansion.py +447 -0
- repodna/agent/localization.py +518 -0
- repodna/agent/models.py +695 -0
- repodna/agent/patch.py +378 -0
- repodna/agent/postflight.py +278 -0
- repodna/agent/preflight.py +336 -0
- repodna/agent/ranking.py +318 -0
- repodna/agent/repo_map.py +392 -0
- repodna/agent/safety.py +111 -0
- repodna/agent/service.py +574 -0
- repodna/agent/sessions.py +264 -0
- repodna/agent/task.py +660 -0
- repodna/agent/telemetry.py +101 -0
- repodna/agent/token_budget.py +231 -0
- repodna/api/__init__.py +1 -0
- repodna/api/agent_routes.py +248 -0
- repodna/api/app.py +2904 -0
- repodna/benchmarks/__init__.py +29 -0
- repodna/benchmarks/baselines.py +126 -0
- repodna/benchmarks/budget_bench.py +162 -0
- repodna/benchmarks/engine.py +418 -0
- repodna/benchmarks/evaluator.py +310 -0
- repodna/benchmarks/metrics.py +206 -0
- repodna/benchmarks/models.py +194 -0
- repodna/benchmarks/scalability.py +166 -0
- repodna/brain/__init__.py +46 -0
- repodna/brain/evidence.py +276 -0
- repodna/brain/extractor.py +1207 -0
- repodna/brain/indexer.py +766 -0
- repodna/brain/models.py +275 -0
- repodna/brain/multilang_extractors.py +889 -0
- repodna/brain/retrieval.py +469 -0
- repodna/brain/tracer.py +203 -0
- repodna/cli/__init__.py +1 -0
- repodna/cli/__main__.py +10 -0
- repodna/cli/agent_cmd.py +228 -0
- repodna/cli/installer.py +590 -0
- repodna/cli/main.py +2173 -0
- repodna/cli/plugin_cmd.py +130 -0
- repodna/cli/workspace_cmd.py +211 -0
- repodna/context/__init__.py +9 -0
- repodna/context/builder.py +379 -0
- repodna/context/models.py +133 -0
- repodna/contract/__init__.py +39 -0
- repodna/contract/evaluator.py +318 -0
- repodna/contract/loader.py +260 -0
- repodna/contract/models.py +185 -0
- repodna/core/__init__.py +1 -0
- repodna/core/analyzer.py +1424 -0
- repodna/diff/__init__.py +35 -0
- repodna/diff/engine.py +332 -0
- repodna/diff/models.py +117 -0
- repodna/diff/snapshot.py +248 -0
- repodna/ecosystem/__init__.py +27 -0
- repodna/ecosystem/contracts.py +129 -0
- repodna/ecosystem/doctor.py +253 -0
- repodna/git_insights/__init__.py +1 -0
- repodna/git_insights/analyzer.py +273 -0
- repodna/graph/__init__.py +1 -0
- repodna/graph/engine.py +562 -0
- repodna/guardian/__init__.py +17 -0
- repodna/guardian/engine.py +369 -0
- repodna/guardian/models.py +104 -0
- repodna/history/__init__.py +40 -0
- repodna/history/cache.py +240 -0
- repodna/history/diff.py +394 -0
- repodna/history/engine.py +557 -0
- repodna/history/evidence.py +160 -0
- repodna/history/models.py +258 -0
- repodna/history/timeline.py +164 -0
- repodna/intelligence/__init__.py +33 -0
- repodna/intelligence/models.py +165 -0
- repodna/intelligence/service.py +570 -0
- repodna/live/__init__.py +94 -0
- repodna/live/alerts.py +443 -0
- repodna/live/coordinator.py +351 -0
- repodna/live/diff.py +444 -0
- repodna/live/events.py +471 -0
- repodna/live/filtering.py +329 -0
- repodna/live/history.py +637 -0
- repodna/live/models.py +505 -0
- repodna/live/observer.py +653 -0
- repodna/live/reconciliation.py +253 -0
- repodna/live/session.py +1547 -0
- repodna/mcp/__init__.py +5 -0
- repodna/mcp/__main__.py +6 -0
- repodna/mcp/agent_tools.py +258 -0
- repodna/mcp/server.py +3283 -0
- repodna/mcp/workspace_tools.py +200 -0
- repodna/parsers/__init__.py +13 -0
- repodna/parsers/base.py +126 -0
- repodna/parsers/capabilities.py +361 -0
- repodna/parsers/project_metadata.py +232 -0
- repodna/parsers/resolver.py +621 -0
- repodna/parsers/treesitter_parser.py +830 -0
- repodna/passport/__init__.py +64 -0
- repodna/passport/generator.py +546 -0
- repodna/passport/migrator.py +139 -0
- repodna/passport/models.py +224 -0
- repodna/passport/validator.py +143 -0
- repodna/performance/__init__.py +89 -0
- repodna/performance/cache.py +1584 -0
- repodna/performance/identity.py +341 -0
- repodna/performance/incremental.py +317 -0
- repodna/performance/models.py +157 -0
- repodna/performance/parallel.py +291 -0
- repodna/plugins/__init__.py +47 -0
- repodna/plugins/evaluator.py +334 -0
- repodna/plugins/models.py +113 -0
- repodna/plugins/validator.py +256 -0
- repodna/quality/__init__.py +91 -0
- repodna/quality/complexity.py +352 -0
- repodna/quality/config.py +159 -0
- repodna/quality/debt.py +73 -0
- repodna/quality/duplicates.py +330 -0
- repodna/quality/engine.py +282 -0
- repodna/quality/impact.py +198 -0
- repodna/quality/models.py +427 -0
- repodna/quality/rules.py +364 -0
- repodna/quality/sarif.py +107 -0
- repodna/quality/security_signals.py +278 -0
- repodna/quality/test_mapping.py +271 -0
- repodna/quality/unused.py +201 -0
- repodna/reports/__init__.py +1 -0
- repodna/reports/exporter.py +374 -0
- repodna/rules/__init__.py +1 -0
- repodna/rules/health.py +436 -0
- repodna/schemas/__init__.py +1 -0
- repodna/schemas/models.py +348 -0
- repodna/security/__init__.py +1 -0
- repodna/security/safe_yaml.py +81 -0
- repodna/security/validators.py +583 -0
- repodna/skills/__init__.py +0 -0
- repodna/skills/repodna/SKILL.md +59 -0
- repodna/skills/repodna/__init__.py +0 -0
- repodna/skills/repodna/examples/workflows.md +85 -0
- repodna/skills/repodna/references/architecture-rules.md +26 -0
- repodna/storage/__init__.py +1 -0
- repodna/storage/workspace.py +199 -0
- repodna/webui/__init__.py +1 -0
- repodna/webui/assets/DependencyGraph-km_Qo-nG.js +43 -0
- repodna/webui/assets/HealthReportView-WVL39aNO.js +1 -0
- repodna/webui/assets/index-ByZ5e5pe.js +506 -0
- repodna/webui/assets/index-CDj3e8hw.css +1 -0
- repodna/webui/index.html +21 -0
- repodna/workspace/__init__.py +131 -0
- repodna/workspace/compatibility.py +317 -0
- repodna/workspace/context.py +175 -0
- repodna/workspace/contracts.py +369 -0
- repodna/workspace/federation.py +411 -0
- repodna/workspace/identity.py +202 -0
- repodna/workspace/impact.py +111 -0
- repodna/workspace/manifest.py +266 -0
- repodna/workspace/models.py +461 -0
- repodna/workspace/packages.py +494 -0
- repodna/workspace/policies.py +142 -0
- repodna/workspace/services.py +238 -0
- repodna/workspace/topology.py +316 -0
- repodna_engine-1.0.1.dist-info/METADATA +129 -0
- repodna_engine-1.0.1.dist-info/RECORD +173 -0
- repodna_engine-1.0.1.dist-info/WHEEL +5 -0
- repodna_engine-1.0.1.dist-info/entry_points.txt +2 -0
- repodna_engine-1.0.1.dist-info/licenses/LICENSE +21 -0
- repodna_engine-1.0.1.dist-info/top_level.txt +1 -0
repodna/mcp/__init__.py
ADDED
repodna/mcp/__main__.py
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"""Agent Intelligence MCP tool schemas, opt-in tool profiles, and read-only annotations."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
# Advisory MCP ToolAnnotations (read-only, non-destructive, idempotent, closed local world)
|
|
8
|
+
# Note: Per MCP spec, annotations are advisory hints, NOT a security enforcement boundary.
|
|
9
|
+
READ_ONLY_TOOL_ANNOTATIONS: dict[str, Any] = {
|
|
10
|
+
"readOnlyHint": True,
|
|
11
|
+
"destructiveHint": False,
|
|
12
|
+
"idempotentHint": True,
|
|
13
|
+
"openWorldHint": False,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
VALID_TOOL_PROFILES: frozenset[str] = frozenset(
|
|
17
|
+
{"full", "minimal", "architecture", "code-intelligence"}
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Opt-in profiles for reducing tools/list metadata token overhead
|
|
21
|
+
PROFILE_ALLOWLISTS: dict[str, frozenset[str] | None] = {
|
|
22
|
+
"full": None, # Default: preserves all 34 legacy tools + 8 v0.11.0 agent tools = 42 tools
|
|
23
|
+
"minimal": frozenset(
|
|
24
|
+
{
|
|
25
|
+
"repodna_repository_overview",
|
|
26
|
+
"repodna_task_context",
|
|
27
|
+
"repodna_repository_map",
|
|
28
|
+
"repodna_expand_context",
|
|
29
|
+
"repodna_change_preflight",
|
|
30
|
+
"repodna_inspect_patch",
|
|
31
|
+
"repodna_change_postflight",
|
|
32
|
+
"repodna_verify_evidence",
|
|
33
|
+
"repodna_agent_capabilities",
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
"architecture": frozenset(
|
|
37
|
+
{
|
|
38
|
+
"repodna_repository_overview",
|
|
39
|
+
"repodna_architecture_map",
|
|
40
|
+
"repodna_get_passport",
|
|
41
|
+
"repodna_module_dependencies",
|
|
42
|
+
"repodna_module_findings",
|
|
43
|
+
"repodna_get_contract",
|
|
44
|
+
"repodna_check_contract",
|
|
45
|
+
"repodna_pr_guardian",
|
|
46
|
+
"repodna_refactoring_advisor",
|
|
47
|
+
"repodna_architecture_diff",
|
|
48
|
+
"repodna_change_impact",
|
|
49
|
+
"repodna_analysis_coverage",
|
|
50
|
+
"repodna_live_status",
|
|
51
|
+
"repodna_live_context",
|
|
52
|
+
"repodna_repository_map",
|
|
53
|
+
"repodna_change_preflight",
|
|
54
|
+
"repodna_change_postflight",
|
|
55
|
+
"repodna_agent_capabilities",
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
"code-intelligence": frozenset(
|
|
59
|
+
{
|
|
60
|
+
"repodna_repository_overview",
|
|
61
|
+
"repodna_search_code",
|
|
62
|
+
"repodna_find_symbol",
|
|
63
|
+
"repodna_trace_symbol",
|
|
64
|
+
"repodna_get_evidence",
|
|
65
|
+
"repodna_code_quality",
|
|
66
|
+
"repodna_get_quality_findings",
|
|
67
|
+
"repodna_symbol_complexity",
|
|
68
|
+
"repodna_find_duplicates",
|
|
69
|
+
"repodna_unused_candidates",
|
|
70
|
+
"repodna_test_relationships",
|
|
71
|
+
"repodna_symbol_change_impact",
|
|
72
|
+
"repodna_task_context",
|
|
73
|
+
"repodna_repository_map",
|
|
74
|
+
"repodna_expand_context",
|
|
75
|
+
"repodna_inspect_patch",
|
|
76
|
+
"repodna_verify_evidence",
|
|
77
|
+
"repodna_agent_capabilities",
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def get_agent_mcp_tool_schemas() -> list[dict[str, Any]]:
|
|
84
|
+
"""Returns deterministic JSON schemas for the 8 v0.11.0 AI Agent Intelligence MCP tools."""
|
|
85
|
+
return [
|
|
86
|
+
{
|
|
87
|
+
"name": "repodna_task_context",
|
|
88
|
+
"description": "Compile a token-budgeted, evidence-grounded context pack (or acknowledged delta pack) for a developer task.",
|
|
89
|
+
"annotations": dict(READ_ONLY_TOOL_ANNOTATIONS),
|
|
90
|
+
"inputSchema": {
|
|
91
|
+
"type": "object",
|
|
92
|
+
"properties": {
|
|
93
|
+
"target": {"type": "string", "default": "."},
|
|
94
|
+
"task": {"type": "string", "description": "Natural-language task description (EN/TR)."},
|
|
95
|
+
"token_budget": {"type": "integer", "default": 2048, "minimum": 64, "maximum": 65536},
|
|
96
|
+
"target_model": {"type": "string", "default": "generic"},
|
|
97
|
+
"tokenizer": {"type": "string", "default": "auto"},
|
|
98
|
+
"profile": {"type": "string", "default": "balanced"},
|
|
99
|
+
"offset": {"type": "integer", "default": 0, "minimum": 0},
|
|
100
|
+
"known_block_ids": {"type": "array", "items": {"type": "string"}},
|
|
101
|
+
"known_block_hashes": {"type": "object"},
|
|
102
|
+
"previous_snapshot_id": {"type": "string"},
|
|
103
|
+
"format": {"type": "string", "enum": ["json", "markdown"], "default": "json"},
|
|
104
|
+
},
|
|
105
|
+
"required": ["target", "task"],
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "repodna_repository_map",
|
|
110
|
+
"description": "Compile a deterministic, token-aware repository map with exported signatures, boundaries, and coverage limits.",
|
|
111
|
+
"annotations": dict(READ_ONLY_TOOL_ANNOTATIONS),
|
|
112
|
+
"inputSchema": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"properties": {
|
|
115
|
+
"target": {"type": "string", "default": "."},
|
|
116
|
+
"mode": {
|
|
117
|
+
"type": "string",
|
|
118
|
+
"enum": [
|
|
119
|
+
"overview",
|
|
120
|
+
"task-focused",
|
|
121
|
+
"symbol-focused",
|
|
122
|
+
"architecture-focused",
|
|
123
|
+
"test-focused",
|
|
124
|
+
"change-focused",
|
|
125
|
+
],
|
|
126
|
+
"default": "overview",
|
|
127
|
+
},
|
|
128
|
+
"task": {"type": "string"},
|
|
129
|
+
"focus_symbol": {"type": "string"},
|
|
130
|
+
"token_budget": {"type": "integer", "default": 2048, "minimum": 64, "maximum": 65536},
|
|
131
|
+
"max_modules": {"type": "integer", "default": 25, "minimum": 1, "maximum": 100},
|
|
132
|
+
},
|
|
133
|
+
"required": ["target"],
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "repodna_expand_context",
|
|
138
|
+
"description": "Progressively expand a bounded file, symbol, evidence, dependency path, finding, test, rule, or live change.",
|
|
139
|
+
"annotations": dict(READ_ONLY_TOOL_ANNOTATIONS),
|
|
140
|
+
"inputSchema": {
|
|
141
|
+
"type": "object",
|
|
142
|
+
"properties": {
|
|
143
|
+
"target": {"type": "string", "default": "."},
|
|
144
|
+
"target_type": {
|
|
145
|
+
"type": "string",
|
|
146
|
+
"enum": [
|
|
147
|
+
"file",
|
|
148
|
+
"symbol",
|
|
149
|
+
"evidence",
|
|
150
|
+
"dependency_path",
|
|
151
|
+
"finding",
|
|
152
|
+
"test_relationship",
|
|
153
|
+
"architecture_rule",
|
|
154
|
+
"live_change",
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
"target_id": {"type": "string"},
|
|
158
|
+
"snapshot_id": {"type": "string"},
|
|
159
|
+
"cursor": {"type": "string"},
|
|
160
|
+
"token_budget": {"type": "integer", "default": 1024, "minimum": 64, "maximum": 65536},
|
|
161
|
+
"max_lines": {"type": "integer", "default": 80, "minimum": 1, "maximum": 200},
|
|
162
|
+
},
|
|
163
|
+
"required": ["target", "target_type", "target_id"],
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "repodna_change_preflight",
|
|
168
|
+
"description": "Read-only pre-edit impact plan separating verified structural impact from explicitly labeled hypothetical risks.",
|
|
169
|
+
"annotations": dict(READ_ONLY_TOOL_ANNOTATIONS),
|
|
170
|
+
"inputSchema": {
|
|
171
|
+
"type": "object",
|
|
172
|
+
"properties": {
|
|
173
|
+
"target": {"type": "string", "default": "."},
|
|
174
|
+
"intended_files": {"type": "array", "items": {"type": "string"}},
|
|
175
|
+
"intended_symbols": {"type": "array", "items": {"type": "string"}},
|
|
176
|
+
"operation_type": {
|
|
177
|
+
"type": "string",
|
|
178
|
+
"enum": ["modify", "add", "delete", "rename", "refactor", "dependency_update"],
|
|
179
|
+
"default": "modify",
|
|
180
|
+
},
|
|
181
|
+
"proposed_dependency_edges": {
|
|
182
|
+
"type": "array",
|
|
183
|
+
"items": {"type": "array", "items": {"type": "string"}, "minItems": 2, "maxItems": 2},
|
|
184
|
+
},
|
|
185
|
+
"expected_behavior": {"type": "string", "default": ""},
|
|
186
|
+
},
|
|
187
|
+
"required": ["target"],
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"name": "repodna_inspect_patch",
|
|
192
|
+
"description": "Bounded read-only unified diff inspection with path validation and fail-closed in-memory projection.",
|
|
193
|
+
"annotations": dict(READ_ONLY_TOOL_ANNOTATIONS),
|
|
194
|
+
"inputSchema": {
|
|
195
|
+
"type": "object",
|
|
196
|
+
"properties": {
|
|
197
|
+
"target": {"type": "string", "default": "."},
|
|
198
|
+
"patch_text": {"type": "string", "description": "Unified diff text (read-only, never applied to disk)."},
|
|
199
|
+
},
|
|
200
|
+
"required": ["target", "patch_text"],
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"name": "repodna_change_postflight",
|
|
205
|
+
"description": "Static snapshot-backed postflight verification comparing before/after snapshots (does not run repository tests).",
|
|
206
|
+
"annotations": dict(READ_ONLY_TOOL_ANNOTATIONS),
|
|
207
|
+
"inputSchema": {
|
|
208
|
+
"type": "object",
|
|
209
|
+
"properties": {
|
|
210
|
+
"target": {"type": "string", "default": "."},
|
|
211
|
+
"intended_files": {"type": "array", "items": {"type": "string"}},
|
|
212
|
+
"stale_evidence_ids": {"type": "array", "items": {"type": "string"}},
|
|
213
|
+
},
|
|
214
|
+
"required": ["target"],
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"name": "repodna_verify_evidence",
|
|
219
|
+
"description": "Verify an evidence ID against current repository snapshot and disk state (VERIFIED/STALE/UNAVAILABLE/PARTIAL/INVALID).",
|
|
220
|
+
"annotations": dict(READ_ONLY_TOOL_ANNOTATIONS),
|
|
221
|
+
"inputSchema": {
|
|
222
|
+
"type": "object",
|
|
223
|
+
"properties": {
|
|
224
|
+
"target": {"type": "string", "default": "."},
|
|
225
|
+
"evidence_id": {"type": "string"},
|
|
226
|
+
"expected_snapshot_id": {"type": "string"},
|
|
227
|
+
},
|
|
228
|
+
"required": ["target", "evidence_id"],
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"name": "repodna_agent_capabilities",
|
|
233
|
+
"description": "Discover RepoDNA read-only capabilities, supported languages, tokenizer mode, tool profiles, and resource bounds.",
|
|
234
|
+
"annotations": dict(READ_ONLY_TOOL_ANNOTATIONS),
|
|
235
|
+
"inputSchema": {
|
|
236
|
+
"type": "object",
|
|
237
|
+
"properties": {},
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
]
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def filter_tools_by_profile(
|
|
244
|
+
tools: list[dict[str, Any]],
|
|
245
|
+
profile: str,
|
|
246
|
+
) -> list[dict[str, Any]]:
|
|
247
|
+
"""Filters tools list by profile while preserving deterministic ordering and adding read-only annotations."""
|
|
248
|
+
norm_profile = (profile or "full").strip().lower()
|
|
249
|
+
allowlist = PROFILE_ALLOWLISTS.get(norm_profile)
|
|
250
|
+
filtered: list[dict[str, Any]] = []
|
|
251
|
+
for tool in tools:
|
|
252
|
+
if allowlist is not None and tool.get("name") not in allowlist:
|
|
253
|
+
continue
|
|
254
|
+
item = dict(tool)
|
|
255
|
+
if "annotations" not in item:
|
|
256
|
+
item["annotations"] = dict(READ_ONLY_TOOL_ANNOTATIONS)
|
|
257
|
+
filtered.append(item)
|
|
258
|
+
return filtered
|