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
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
"""Typed and versioned domain models for RepoDNA v0.13.0 Multi-Repository Intelligence."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from datetime import UTC, datetime
|
|
6
|
+
from enum import StrEnum
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, Field
|
|
10
|
+
|
|
11
|
+
WORKSPACE_SCHEMA_VERSION = "1.0"
|
|
12
|
+
MAX_WORKSPACE_REPOS = 32
|
|
13
|
+
MAX_MANIFEST_BYTES = 262_144
|
|
14
|
+
MAX_YAML_DEPTH = 16
|
|
15
|
+
MAX_CONCURRENT_REPOS = 4
|
|
16
|
+
MAX_IMPACT_HOPS = 6
|
|
17
|
+
MAX_IMPACT_NODES = 250
|
|
18
|
+
MAX_OPENAPI_BYTES = 2_097_152
|
|
19
|
+
MAX_OPENAPI_REF_DEPTH = 12
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class WorkspaceValidationError(ValueError):
|
|
23
|
+
"""Structured fail-closed validation error for workspace manifests and operations."""
|
|
24
|
+
|
|
25
|
+
def __init__(self, code: str, message: str) -> None:
|
|
26
|
+
super().__init__(message)
|
|
27
|
+
self.code = code
|
|
28
|
+
self.message = message
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class RepositoryMembershipStatus(StrEnum):
|
|
32
|
+
AVAILABLE = "AVAILABLE"
|
|
33
|
+
MISSING = "MISSING"
|
|
34
|
+
INACCESSIBLE = "INACCESSIBLE"
|
|
35
|
+
UNSUPPORTED = "UNSUPPORTED"
|
|
36
|
+
ANALYZING = "ANALYZING"
|
|
37
|
+
FAILED = "FAILED"
|
|
38
|
+
STALE = "STALE"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class WorkspaceConsistencyStatus(StrEnum):
|
|
42
|
+
VERIFIED_VECTOR = "VERIFIED_VECTOR"
|
|
43
|
+
PARTIALLY_VERIFIED = "PARTIALLY_VERIFIED"
|
|
44
|
+
CHANGES_PENDING = "CHANGES_PENDING"
|
|
45
|
+
STALE = "STALE"
|
|
46
|
+
INCOMPLETE = "INCOMPLETE"
|
|
47
|
+
UNKNOWN = "UNKNOWN"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class CrossRepoEdgeKind(StrEnum):
|
|
51
|
+
PACKAGE_DEPENDENCY = "PACKAGE_DEPENDENCY"
|
|
52
|
+
PROJECT_REFERENCE = "PROJECT_REFERENCE"
|
|
53
|
+
SOURCE_IMPORT = "SOURCE_IMPORT"
|
|
54
|
+
SDK_CONSUMER = "SDK_CONSUMER"
|
|
55
|
+
HTTP_API_CONSUMER = "HTTP_API_CONSUMER"
|
|
56
|
+
GRPC_CONSUMER = "GRPC_CONSUMER"
|
|
57
|
+
MESSAGE_CHANNEL = "MESSAGE_CHANNEL"
|
|
58
|
+
SHARED_CONTRACT = "SHARED_CONTRACT"
|
|
59
|
+
CONFIGURED_RELATIONSHIP = "CONFIGURED_RELATIONSHIP"
|
|
60
|
+
CANDIDATE_RELATIONSHIP = "CANDIDATE_RELATIONSHIP"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class ResolutionStatus(StrEnum):
|
|
64
|
+
VERIFIED = "VERIFIED"
|
|
65
|
+
CANDIDATE = "CANDIDATE"
|
|
66
|
+
AMBIGUOUS = "AMBIGUOUS"
|
|
67
|
+
UNRESOLVED = "UNRESOLVED"
|
|
68
|
+
EXTERNAL = "EXTERNAL"
|
|
69
|
+
UNSUPPORTED = "UNSUPPORTED"
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class CompatibilityClassification(StrEnum):
|
|
73
|
+
BREAKING = "BREAKING"
|
|
74
|
+
POTENTIALLY_BREAKING = "POTENTIALLY_BREAKING"
|
|
75
|
+
NON_BREAKING = "NON_BREAKING"
|
|
76
|
+
UNKNOWN = "UNKNOWN"
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class VersionCompatibilityStatus(StrEnum):
|
|
80
|
+
DECLARED_COMPATIBLE = "DECLARED_COMPATIBLE"
|
|
81
|
+
DECLARED_INCOMPATIBLE = "DECLARED_INCOMPATIBLE"
|
|
82
|
+
VERSION_UNKNOWN = "VERSION_UNKNOWN"
|
|
83
|
+
CONSTRAINT_UNSUPPORTED = "CONSTRAINT_UNSUPPORTED"
|
|
84
|
+
AMBIGUOUS_PROVIDER = "AMBIGUOUS_PROVIDER"
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class ImpactLevel(StrEnum):
|
|
88
|
+
DIRECT_VERIFIED = "DIRECT_VERIFIED"
|
|
89
|
+
TRANSITIVE_VERIFIED = "TRANSITIVE_VERIFIED"
|
|
90
|
+
DIRECT_CANDIDATE = "DIRECT_CANDIDATE"
|
|
91
|
+
TRANSITIVE_CANDIDATE = "TRANSITIVE_CANDIDATE"
|
|
92
|
+
UNKNOWN = "UNKNOWN"
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class WorkspacePolicyVerdict(StrEnum):
|
|
96
|
+
PASS = "PASS"
|
|
97
|
+
WARNING = "WARNING"
|
|
98
|
+
FAIL = "FAIL"
|
|
99
|
+
INCONCLUSIVE = "INCONCLUSIVE"
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class WorkspacePolicyKind(StrEnum):
|
|
103
|
+
FORBIDDEN_REPO_DEPENDENCY = "forbidden_repo_dependency"
|
|
104
|
+
ALLOWED_DEPENDENCY_DIRECTION = "allowed_dependency_direction"
|
|
105
|
+
NO_CIRCULAR_REPO_DEPENDENCIES = "no_circular_repo_dependencies"
|
|
106
|
+
REQUIRED_CONTRACT_BOUNDARY = "required_contract_boundary"
|
|
107
|
+
API_COMPATIBILITY_ENFORCEMENT = "api_compatibility_enforcement"
|
|
108
|
+
MAX_CROSS_REPO_COUPLING = "max_cross_repo_coupling"
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class WorkspaceRepositoryEntry(BaseModel):
|
|
112
|
+
"""Explicitly declared repository member in repodna-workspace.yml."""
|
|
113
|
+
|
|
114
|
+
alias: str = Field(..., min_length=1, max_length=64, pattern=r"^[a-zA-Z0-9._-]+$")
|
|
115
|
+
path: str = Field(..., min_length=1, max_length=1024)
|
|
116
|
+
role: str = Field(default="service", max_length=64)
|
|
117
|
+
profile: str = Field(default="standard", max_length=32)
|
|
118
|
+
contracts: list[str] = Field(default_factory=list)
|
|
119
|
+
tags: list[str] = Field(default_factory=list)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class WorkspacePolicyRule(BaseModel):
|
|
123
|
+
"""Declarative zero-execution workspace architecture policy rule."""
|
|
124
|
+
|
|
125
|
+
rule_id: str = Field(..., min_length=2, max_length=64, pattern=r"^[A-Za-z0-9._-]+$")
|
|
126
|
+
kind: WorkspacePolicyKind
|
|
127
|
+
severity: str = Field(default="warning", pattern=r"^(critical|warning|info)$")
|
|
128
|
+
title: str = Field(..., min_length=2, max_length=200)
|
|
129
|
+
enforce_on_candidates: bool = False
|
|
130
|
+
params: dict[str, Any] = Field(default_factory=dict)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class WorkspaceResourceLimits(BaseModel):
|
|
134
|
+
"""Bounded global execution limits for multi-repository analysis."""
|
|
135
|
+
|
|
136
|
+
max_concurrent_repos: int = Field(default=2, ge=1, le=MAX_CONCURRENT_REPOS)
|
|
137
|
+
max_workers_per_repo: int = Field(default=2, ge=1, le=4)
|
|
138
|
+
max_impact_hops: int = Field(default=4, ge=1, le=MAX_IMPACT_HOPS)
|
|
139
|
+
max_impact_nodes: int = Field(default=200, ge=10, le=MAX_IMPACT_NODES)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class WorkspaceManifest(BaseModel):
|
|
143
|
+
"""Versioned, declarative multi-repository workspace manifest (`repodna-workspace.yml`)."""
|
|
144
|
+
|
|
145
|
+
schema_version: str = WORKSPACE_SCHEMA_VERSION
|
|
146
|
+
workspace_id: str = Field(..., min_length=2, max_length=64, pattern=r"^[a-zA-Z0-9._-]+$")
|
|
147
|
+
name: str = Field(..., min_length=1, max_length=128)
|
|
148
|
+
description: str = Field(default="", max_length=500)
|
|
149
|
+
repositories: list[WorkspaceRepositoryEntry] = Field(default_factory=list)
|
|
150
|
+
service_mappings: dict[str, str] = Field(default_factory=dict)
|
|
151
|
+
package_mappings: dict[str, str] = Field(default_factory=dict)
|
|
152
|
+
policies: list[WorkspacePolicyRule] = Field(default_factory=list)
|
|
153
|
+
limits: WorkspaceResourceLimits = Field(default_factory=WorkspaceResourceLimits)
|
|
154
|
+
manifest_dir: str = ""
|
|
155
|
+
manifest_fingerprint: str = ""
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class RepositorySnapshotRef(BaseModel):
|
|
159
|
+
"""Per-repository identity and snapshot provenance inside a WorkspaceSnapshot vector."""
|
|
160
|
+
|
|
161
|
+
repository_id: str
|
|
162
|
+
alias: str
|
|
163
|
+
display_name: str
|
|
164
|
+
canonical_path: str
|
|
165
|
+
status: RepositoryMembershipStatus
|
|
166
|
+
snapshot_id: str | None = None
|
|
167
|
+
commit_sha: str | None = None
|
|
168
|
+
is_dirty: bool = False
|
|
169
|
+
is_worktree: bool = False
|
|
170
|
+
remote_url: str | None = None
|
|
171
|
+
languages: list[str] = Field(default_factory=list)
|
|
172
|
+
total_files: int = 0
|
|
173
|
+
health_score: float | None = None
|
|
174
|
+
health_grade: str | None = None
|
|
175
|
+
error_message: str | None = None
|
|
176
|
+
reused_from_cache: bool = False
|
|
177
|
+
duration_ms: float = 0.0
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class WorkspaceSnapshot(BaseModel):
|
|
181
|
+
"""Composite snapshot vector across workspace repositories (explicitly non-atomic)."""
|
|
182
|
+
|
|
183
|
+
workspace_id: str
|
|
184
|
+
workspace_snapshot_id: str
|
|
185
|
+
manifest_fingerprint: str
|
|
186
|
+
policy_fingerprint: str
|
|
187
|
+
consistency_status: WorkspaceConsistencyStatus
|
|
188
|
+
consistency_note: str
|
|
189
|
+
created_at: str = Field(default_factory=lambda: datetime.now(UTC).isoformat())
|
|
190
|
+
repositories: list[RepositorySnapshotRef] = Field(default_factory=list)
|
|
191
|
+
available_count: int = 0
|
|
192
|
+
missing_or_failed_count: int = 0
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
class PackageIdentity(BaseModel):
|
|
196
|
+
"""Static package identity extracted from repository metadata (distinct from repository_id)."""
|
|
197
|
+
|
|
198
|
+
package_key: str
|
|
199
|
+
ecosystem: str # python, npm, cargo, go, nuget, maven, cmake
|
|
200
|
+
name: str
|
|
201
|
+
version: str | None = None
|
|
202
|
+
repository_id: str
|
|
203
|
+
repository_alias: str
|
|
204
|
+
manifest_file: str
|
|
205
|
+
evidence: str
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class PackageDependencyDecl(BaseModel):
|
|
209
|
+
"""Declared dependency of a repository on a package or local project."""
|
|
210
|
+
|
|
211
|
+
source_repository_id: str
|
|
212
|
+
source_alias: str
|
|
213
|
+
ecosystem: str
|
|
214
|
+
target_name: str
|
|
215
|
+
version_constraint: str | None = None
|
|
216
|
+
is_local_path_ref: bool = False
|
|
217
|
+
local_target_path: str | None = None
|
|
218
|
+
manifest_file: str
|
|
219
|
+
from_lockfile: bool = False
|
|
220
|
+
evidence: str
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
class VersionConstraintFinding(BaseModel):
|
|
224
|
+
"""Evaluation of a consumer's declared version constraint against a workspace provider."""
|
|
225
|
+
|
|
226
|
+
source_repository_id: str
|
|
227
|
+
source_alias: str
|
|
228
|
+
target_repository_id: str | None = None
|
|
229
|
+
target_alias: str | None = None
|
|
230
|
+
ecosystem: str
|
|
231
|
+
package_name: str
|
|
232
|
+
declared_constraint: str | None = None
|
|
233
|
+
provider_version: str | None = None
|
|
234
|
+
status: VersionCompatibilityStatus
|
|
235
|
+
reason: str
|
|
236
|
+
evidence: str
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
class EndpointIdentity(BaseModel):
|
|
240
|
+
"""Static HTTP/gRPC/channel endpoint discovered from AST or contract files."""
|
|
241
|
+
|
|
242
|
+
endpoint_id: str
|
|
243
|
+
protocol: str = "http"
|
|
244
|
+
method: str = "GET"
|
|
245
|
+
path: str
|
|
246
|
+
operation_id: str | None = None
|
|
247
|
+
repository_id: str
|
|
248
|
+
repository_alias: str
|
|
249
|
+
source_file: str
|
|
250
|
+
line: int | None = None
|
|
251
|
+
source_kind: str = "ast_route" # ast_route | openapi | compose | k8s
|
|
252
|
+
confidence: float = 0.7
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
class ServiceIdentity(BaseModel):
|
|
256
|
+
"""Static service catalog entry (explicitly NOT runtime network observability)."""
|
|
257
|
+
|
|
258
|
+
service_id: str
|
|
259
|
+
repository_id: str
|
|
260
|
+
repository_alias: str
|
|
261
|
+
name: str
|
|
262
|
+
language: str
|
|
263
|
+
framework: str
|
|
264
|
+
entry_points: list[str] = Field(default_factory=list)
|
|
265
|
+
provided_endpoints: list[EndpointIdentity] = Field(default_factory=list)
|
|
266
|
+
consumed_endpoints: list[str] = Field(default_factory=list)
|
|
267
|
+
contract_ids: list[str] = Field(default_factory=list)
|
|
268
|
+
config_references: list[str] = Field(default_factory=list)
|
|
269
|
+
confidence: float = 0.7
|
|
270
|
+
limitations: list[str] = Field(default_factory=list)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
class ContractOperation(BaseModel):
|
|
274
|
+
"""Normalized OpenAPI operation representation for deterministic structural diffing."""
|
|
275
|
+
|
|
276
|
+
path: str
|
|
277
|
+
method: str
|
|
278
|
+
operation_id: str | None = None
|
|
279
|
+
required_params: list[str] = Field(default_factory=list)
|
|
280
|
+
optional_params: list[str] = Field(default_factory=list)
|
|
281
|
+
request_required_props: list[str] = Field(default_factory=list)
|
|
282
|
+
request_props: dict[str, str] = Field(default_factory=dict)
|
|
283
|
+
request_enums: dict[str, list[str]] = Field(default_factory=dict)
|
|
284
|
+
response_statuses: list[str] = Field(default_factory=list)
|
|
285
|
+
response_props: dict[str, dict[str, str]] = Field(default_factory=dict)
|
|
286
|
+
response_enums: dict[str, dict[str, list[str]]] = Field(default_factory=dict)
|
|
287
|
+
security_schemes: list[str] = Field(default_factory=list)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
class ContractDefinition(BaseModel):
|
|
291
|
+
"""Parsed static API contract document (OpenAPI 3.0/3.1, or PARTIAL/UNSUPPORTED notice)."""
|
|
292
|
+
|
|
293
|
+
contract_id: str
|
|
294
|
+
format: str # openapi_3_0 | openapi_3_1 | protobuf | asyncapi | graphql
|
|
295
|
+
support_status: str = "SUPPORTED" # SUPPORTED | PARTIAL | UNSUPPORTED
|
|
296
|
+
title: str
|
|
297
|
+
version: str | None = None
|
|
298
|
+
repository_id: str
|
|
299
|
+
repository_alias: str
|
|
300
|
+
file_path: str
|
|
301
|
+
fingerprint: str
|
|
302
|
+
operations: list[ContractOperation] = Field(default_factory=list)
|
|
303
|
+
limitations: list[str] = Field(default_factory=list)
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
class ContractCompatibilityFinding(BaseModel):
|
|
307
|
+
"""Variance-aware structural compatibility finding between before/after API contracts."""
|
|
308
|
+
|
|
309
|
+
finding_id: str
|
|
310
|
+
provider_repository_id: str
|
|
311
|
+
provider_alias: str
|
|
312
|
+
affected_consumer_repositories: list[str] = Field(default_factory=list)
|
|
313
|
+
contract_id: str
|
|
314
|
+
endpoint: str
|
|
315
|
+
change_type: str
|
|
316
|
+
classification: CompatibilityClassification
|
|
317
|
+
message: str
|
|
318
|
+
evidence: str
|
|
319
|
+
confidence: float = 0.9
|
|
320
|
+
limitation: str = (
|
|
321
|
+
"Structural contract analysis only; does not guarantee runtime production failure or compatibility."
|
|
322
|
+
)
|
|
323
|
+
suggested_verification: str = ""
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
class CrossRepositoryEdge(BaseModel):
|
|
327
|
+
"""Evidence-backed directed relationship between two repositories."""
|
|
328
|
+
|
|
329
|
+
edge_id: str
|
|
330
|
+
source_repository_id: str
|
|
331
|
+
source_alias: str
|
|
332
|
+
target_repository_id: str | None = None
|
|
333
|
+
target_alias: str | None = None
|
|
334
|
+
source_symbol_or_file: str = ""
|
|
335
|
+
target_symbol_or_file: str = ""
|
|
336
|
+
kind: CrossRepoEdgeKind
|
|
337
|
+
resolution_status: ResolutionStatus
|
|
338
|
+
confidence: float
|
|
339
|
+
evidence: list[str] = Field(default_factory=list)
|
|
340
|
+
snapshot_vector_id: str = ""
|
|
341
|
+
note: str = ""
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
class WorkspaceCycle(BaseModel):
|
|
345
|
+
"""Cross-repository circular dependency cycle."""
|
|
346
|
+
|
|
347
|
+
cycle_id: str
|
|
348
|
+
repository_aliases: list[str]
|
|
349
|
+
repository_ids: list[str]
|
|
350
|
+
verified_only: bool
|
|
351
|
+
edge_ids: list[str]
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
class WorkspaceTopologyGraph(BaseModel):
|
|
355
|
+
"""Hierarchical workspace dependency graph."""
|
|
356
|
+
|
|
357
|
+
workspace_id: str
|
|
358
|
+
nodes: list[dict[str, Any]] = Field(default_factory=list)
|
|
359
|
+
edges: list[CrossRepositoryEdge] = Field(default_factory=list)
|
|
360
|
+
verified_cycles: list[WorkspaceCycle] = Field(default_factory=list)
|
|
361
|
+
candidate_cycles: list[WorkspaceCycle] = Field(default_factory=list)
|
|
362
|
+
coverage_note: str = (
|
|
363
|
+
"Static cross-repository topology only. Absence of detected cycles does not prove runtime acyclicity."
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
class WorkspaceImpactItem(BaseModel):
|
|
368
|
+
"""Affected downstream repository/symbol/test for a cross-repository change."""
|
|
369
|
+
|
|
370
|
+
repository_id: str
|
|
371
|
+
repository_alias: str
|
|
372
|
+
impact_level: ImpactLevel
|
|
373
|
+
hop_distance: int
|
|
374
|
+
via_edge_ids: list[str] = Field(default_factory=list)
|
|
375
|
+
candidate_symbols: list[str] = Field(default_factory=list)
|
|
376
|
+
related_tests: list[str] = Field(default_factory=list)
|
|
377
|
+
evidence: list[str] = Field(default_factory=list)
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
class WorkspaceImpactReport(BaseModel):
|
|
381
|
+
"""Bounded cross-repository change impact report."""
|
|
382
|
+
|
|
383
|
+
workspace_id: str
|
|
384
|
+
changed_repository_id: str
|
|
385
|
+
changed_alias: str
|
|
386
|
+
changed_targets: list[str] = Field(default_factory=list)
|
|
387
|
+
direct_impacts: list[WorkspaceImpactItem] = Field(default_factory=list)
|
|
388
|
+
transitive_impacts: list[WorkspaceImpactItem] = Field(default_factory=list)
|
|
389
|
+
compatibility_findings: list[ContractCompatibilityFinding] = Field(default_factory=list)
|
|
390
|
+
truncated: bool = False
|
|
391
|
+
limitations: list[str] = Field(default_factory=list)
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
class WorkspacePolicyFinding(BaseModel):
|
|
395
|
+
"""Single workspace-level policy evaluation result."""
|
|
396
|
+
|
|
397
|
+
rule_id: str
|
|
398
|
+
kind: WorkspacePolicyKind
|
|
399
|
+
severity: str
|
|
400
|
+
verdict: WorkspacePolicyVerdict
|
|
401
|
+
message: str
|
|
402
|
+
source_alias: str | None = None
|
|
403
|
+
target_alias: str | None = None
|
|
404
|
+
evidence: list[str] = Field(default_factory=list)
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
class WorkspacePolicyReport(BaseModel):
|
|
408
|
+
"""Workspace Architecture Guardian report."""
|
|
409
|
+
|
|
410
|
+
workspace_id: str
|
|
411
|
+
verdict: WorkspacePolicyVerdict
|
|
412
|
+
findings: list[WorkspacePolicyFinding] = Field(default_factory=list)
|
|
413
|
+
evaluated_rules: int = 0
|
|
414
|
+
incomplete_reason: str | None = None
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
class WorkspaceContextBlock(BaseModel):
|
|
418
|
+
"""Repository-attributed block inside a global-budgeted WorkspaceContextPack."""
|
|
419
|
+
|
|
420
|
+
block_id: str
|
|
421
|
+
repository_id: str
|
|
422
|
+
repository_alias: str
|
|
423
|
+
category: str
|
|
424
|
+
title: str
|
|
425
|
+
content: str
|
|
426
|
+
estimated_tokens: int
|
|
427
|
+
evidence: list[str] = Field(default_factory=list)
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
class WorkspaceContextPack(BaseModel):
|
|
431
|
+
"""Token-budgeted multi-repository AI agent context pack."""
|
|
432
|
+
|
|
433
|
+
workspace_id: str
|
|
434
|
+
workspace_snapshot_id: str
|
|
435
|
+
task: str
|
|
436
|
+
token_budget: int
|
|
437
|
+
used_tokens: int
|
|
438
|
+
tokenizer_mode: str = "estimated"
|
|
439
|
+
blocks: list[WorkspaceContextBlock] = Field(default_factory=list)
|
|
440
|
+
omitted_count: int = 0
|
|
441
|
+
limitations: list[str] = Field(default_factory=list)
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
class WorkspaceAnalysisResult(BaseModel):
|
|
445
|
+
"""Unified multi-repository analysis output."""
|
|
446
|
+
|
|
447
|
+
schema_version: str = WORKSPACE_SCHEMA_VERSION
|
|
448
|
+
workspace_id: str
|
|
449
|
+
workspace_name: str
|
|
450
|
+
snapshot: WorkspaceSnapshot
|
|
451
|
+
packages: list[PackageIdentity] = Field(default_factory=list)
|
|
452
|
+
package_dependencies: list[PackageDependencyDecl] = Field(default_factory=list)
|
|
453
|
+
version_findings: list[VersionConstraintFinding] = Field(default_factory=list)
|
|
454
|
+
services: list[ServiceIdentity] = Field(default_factory=list)
|
|
455
|
+
contracts: list[ContractDefinition] = Field(default_factory=list)
|
|
456
|
+
topology: WorkspaceTopologyGraph
|
|
457
|
+
policy_report: WorkspacePolicyReport
|
|
458
|
+
duration_ms: float = 0.0
|
|
459
|
+
reused_repositories: int = 0
|
|
460
|
+
recomputed_repositories: int = 0
|
|
461
|
+
limitations: list[str] = Field(default_factory=list)
|