Repository navigation
Expand file tree
/
Copy pathAgentAccessContracts.cs
More file actions
236 lines (212 loc) · 15.5 KB
/
Copy pathAgentAccessContracts.cs
File metadata and controls
236 lines (212 loc) · 15.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
using System.Text.Json;
using System.Text.Json.Serialization;
using CodeMesh.Domain.Graph;
namespace CodeMesh.Domain.Contracts;
public sealed record AgentHealthResult(
[property: JsonPropertyName("service")] string Service,
[property: JsonPropertyName("status")] string Status,
[property: JsonPropertyName("checked_at")] DateTimeOffset CheckedAt,
[property: JsonPropertyName("components")] IReadOnlyDictionary<string, JsonElement> Components);
public sealed record AgentContextQuery(
[property: JsonPropertyName("query")] string Query,
[property: JsonPropertyName("repository_id")] string? RepositoryId = null,
[property: JsonPropertyName("limit")] int Limit = 8,
[property: JsonPropertyName("kinds")] IReadOnlyList<string>? Kinds = null,
[property: JsonPropertyName("filters")] IReadOnlyDictionary<string, string>? Filters = null,
[property: JsonPropertyName("vector")] IReadOnlyList<float>? Vector = null,
[property: JsonPropertyName("expand_context")] bool ExpandContext = true,
[property: JsonPropertyName("context_depth")] int ContextDepth = 4,
[property: JsonPropertyName("include_context_relationships")] bool IncludeContextRelationships = false,
[property: JsonPropertyName("context_relationship_limit")] int ContextRelationshipLimit = 8);
public sealed record CodeSearchHit(
[property: JsonPropertyName("node_id")] string NodeId,
[property: JsonPropertyName("stable_key")] string StableKey,
[property: JsonPropertyName("kind")]
[property: JsonConverter(typeof(JsonStringEnumConverter<CodeNodeKind>))]
CodeNodeKind Kind,
[property: JsonPropertyName("file_path")] string FilePath,
[property: JsonPropertyName("start_line")] int StartLine,
[property: JsonPropertyName("end_line")] int EndLine,
[property: JsonPropertyName("score")] double Score,
[property: JsonPropertyName("repository_id")] string? RepositoryId = null,
[property: JsonPropertyName("content_hash")] string? ContentHash = null,
[property: JsonPropertyName("score_components")] IReadOnlyDictionary<string, double>? ScoreComponents = null,
[property: JsonPropertyName("expanded_context")] IReadOnlyDictionary<string, JsonElement>? ExpandedContext = null,
[property: JsonPropertyName("preview")] string? Preview = null,
[property: JsonPropertyName("snapshot_id")] string? SnapshotId = null);
public sealed record AgentContextDiagnostics(
[property: JsonPropertyName("mode")] string Mode,
[property: JsonPropertyName("embedding_attempted")] bool EmbeddingAttempted,
[property: JsonPropertyName("embedding_source")] string EmbeddingSource,
[property: JsonPropertyName("model_provider")] string ModelProvider,
[property: JsonPropertyName("vector_available")] bool VectorAvailable,
[property: JsonPropertyName("vector_hit_count")] int VectorHitCount,
[property: JsonPropertyName("lexical_hit_count")] int LexicalHitCount,
[property: JsonPropertyName("summary_hit_count")] int SummaryHitCount,
[property: JsonPropertyName("vector_candidate_count")] int VectorCandidateCount,
[property: JsonPropertyName("lexical_candidate_count")] int LexicalCandidateCount,
[property: JsonPropertyName("summary_candidate_count")] int SummaryCandidateCount,
[property: JsonPropertyName("lexical_fallback")] bool LexicalFallback,
[property: JsonPropertyName("hit_count")] int HitCount,
[property: JsonPropertyName("selected_project_id")] string? SelectedProjectId = null,
[property: JsonPropertyName("selected_snapshot_id")] string? SelectedSnapshotId = null);
public sealed record AgentContextResult(
[property: JsonPropertyName("query")] AgentContextQuery Query,
[property: JsonPropertyName("hits")] IReadOnlyList<CodeSearchHit> Hits,
[property: JsonPropertyName("diagnostics")] AgentContextDiagnostics? Diagnostics,
[property: JsonPropertyName("generated_at")] DateTimeOffset GeneratedAt);
public sealed record AgentContextPackageQuery(
[property: JsonPropertyName("query")] string Query,
[property: JsonPropertyName("repository_id")] string? RepositoryId = null,
[property: JsonPropertyName("limit")] int Limit = 8,
[property: JsonPropertyName("max_characters")] int MaxCharacters = 12000,
[property: JsonPropertyName("kinds")] IReadOnlyList<string>? Kinds = null,
[property: JsonPropertyName("filters")] IReadOnlyDictionary<string, string>? Filters = null,
[property: JsonPropertyName("vector")] IReadOnlyList<float>? Vector = null,
[property: JsonPropertyName("context_depth")] int ContextDepth = 4,
[property: JsonPropertyName("include_content")] bool IncludeContent = true,
[property: JsonPropertyName("include_relationships")] bool IncludeRelationships = true,
[property: JsonPropertyName("relationship_limit")] int RelationshipLimit = 8,
[property: JsonPropertyName("caller_limit")] int? CallerLimit = null,
[property: JsonPropertyName("callee_limit")] int? CalleeLimit = null,
[property: JsonPropertyName("read_limit")] int? ReadLimit = null,
[property: JsonPropertyName("write_limit")] int? WriteLimit = null,
[property: JsonPropertyName("contains_limit")] int? ContainsLimit = null,
[property: JsonPropertyName("definition_limit")] int? DefinitionLimit = null,
[property: JsonPropertyName("uses_type_limit")] int? UsesTypeLimit = null,
[property: JsonPropertyName("include_repository")] bool IncludeRepository = true);
public sealed record AgentContextPackageItem(
[property: JsonPropertyName("hit")] CodeSearchHit Hit,
[property: JsonPropertyName("node")] IReadOnlyDictionary<string, JsonElement>? Node = null,
[property: JsonPropertyName("content")] IReadOnlyDictionary<string, JsonElement>? Content = null,
[property: JsonPropertyName("summary")] IReadOnlyDictionary<string, JsonElement>? Summary = null,
[property: JsonPropertyName("snippet")] string? Snippet = null,
[property: JsonPropertyName("relationships")] IReadOnlyList<IReadOnlyDictionary<string, JsonElement>>? Relationships = null,
[property: JsonPropertyName("relationship_groups")] IReadOnlyDictionary<string, IReadOnlyList<IReadOnlyDictionary<string, JsonElement>>>? RelationshipGroups = null,
[property: JsonPropertyName("rationale")] IReadOnlyDictionary<string, JsonElement>? Rationale = null);
public sealed record AgentContextPackageResult(
[property: JsonPropertyName("query")] AgentContextPackageQuery Query,
[property: JsonPropertyName("repository")] IReadOnlyDictionary<string, JsonElement>? Repository,
[property: JsonPropertyName("latest_run")] IReadOnlyDictionary<string, JsonElement>? LatestRun,
[property: JsonPropertyName("items")] IReadOnlyList<AgentContextPackageItem> Items,
[property: JsonPropertyName("validation_recommendations")] IReadOnlyList<IReadOnlyDictionary<string, JsonElement>>? ValidationRecommendations,
[property: JsonPropertyName("total_snippet_characters")] int TotalSnippetCharacters,
[property: JsonPropertyName("generated_at")] DateTimeOffset GeneratedAt);
public sealed record AgentSymbolQuery(
[property: JsonPropertyName("query")] string Query,
[property: JsonPropertyName("repository_id")] string? RepositoryId = null,
[property: JsonPropertyName("limit")] int Limit = 20,
[property: JsonPropertyName("kinds")] IReadOnlyList<string>? Kinds = null,
[property: JsonPropertyName("filters")] IReadOnlyDictionary<string, string>? Filters = null,
[property: JsonPropertyName("include_declarations")] bool IncludeDeclarations = true);
public sealed record AgentSymbolSearchHit(
[property: JsonPropertyName("node")] IReadOnlyDictionary<string, JsonElement> Node,
[property: JsonPropertyName("declaration")] IReadOnlyDictionary<string, JsonElement>? Declaration,
[property: JsonPropertyName("score")] double Score,
[property: JsonPropertyName("score_components")] IReadOnlyDictionary<string, double>? ScoreComponents = null);
public sealed record AgentSymbolSearchResult(
[property: JsonPropertyName("query")] AgentSymbolQuery Query,
[property: JsonPropertyName("symbols")] IReadOnlyList<AgentSymbolSearchHit> Symbols,
[property: JsonPropertyName("generated_at")] DateTimeOffset GeneratedAt);
public sealed record AgentNodeLookup(
[property: JsonPropertyName("node_id")] string NodeId,
[property: JsonPropertyName("repository_id")] string? RepositoryId = null,
[property: JsonPropertyName("include_content")] bool IncludeContent = true,
[property: JsonPropertyName("include_neighbors")] bool IncludeNeighbors = true);
public sealed record AgentNodeResult(
[property: JsonPropertyName("node")] IReadOnlyDictionary<string, JsonElement>? Node,
[property: JsonPropertyName("content")] IReadOnlyDictionary<string, JsonElement>? Content,
[property: JsonPropertyName("relationships")] IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> Relationships);
public sealed record AgentNeighborQuery(
[property: JsonPropertyName("node_id")] string NodeId,
[property: JsonPropertyName("repository_id")] string? RepositoryId = null,
[property: JsonPropertyName("depth")] int Depth = 1,
[property: JsonPropertyName("relationship_kinds")] IReadOnlyList<string>? RelationshipKinds = null);
public sealed record AgentNeighborResult(
[property: JsonPropertyName("node")] IReadOnlyDictionary<string, JsonElement>? Node,
[property: JsonPropertyName("content")] IReadOnlyDictionary<string, JsonElement>? Content,
[property: JsonPropertyName("relationships")] IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> Relationships);
public sealed record AgentRepositorySummary(
[property: JsonPropertyName("repository_id")] string RepositoryId,
[property: JsonPropertyName("alias")] string? Alias,
[property: JsonPropertyName("root_path")] string RootPath,
[property: JsonPropertyName("remote_url")] string? RemoteUrl,
[property: JsonPropertyName("branch")] string? Branch,
[property: JsonPropertyName("commit")] string? Commit,
[property: JsonPropertyName("first_seen_at")] DateTimeOffset? FirstSeenAt,
[property: JsonPropertyName("last_seen_at")] DateTimeOffset? LastSeenAt,
[property: JsonPropertyName("last_run_id")] string? LastRunId,
[property: JsonPropertyName("last_stage")] string? LastStage,
[property: JsonPropertyName("last_message")] string? LastMessage,
[property: JsonPropertyName("node_count")] int NodeCount,
[property: JsonPropertyName("relationship_count")] int RelationshipCount,
[property: JsonPropertyName("content_count")] int ContentCount,
[property: JsonPropertyName("embedding_count")] int? EmbeddingCount,
[property: JsonPropertyName("metadata")] IReadOnlyDictionary<string, string>? Metadata,
[property: JsonPropertyName("project_id")] string? ProjectId = null,
[property: JsonPropertyName("checkout_id")] string? CheckoutId = null,
[property: JsonPropertyName("snapshot_id")] string? SnapshotId = null,
[property: JsonPropertyName("slot_kind")] string? SlotKind = null,
[property: JsonPropertyName("source_view_hash")] string? SourceViewHash = null);
public sealed record AgentRepositoryListResult(
[property: JsonPropertyName("repositories")] IReadOnlyList<AgentRepositorySummary> Repositories);
public sealed record AgentRepositoryDeleteResult(
[property: JsonPropertyName("repository_id")] string RepositoryId,
[property: JsonPropertyName("deleted")] bool Deleted,
[property: JsonPropertyName("registry_entry_existed")] bool RegistryEntryExisted,
[property: JsonPropertyName("graph_cleaned")] bool GraphCleaned,
[property: JsonPropertyName("content_cleaned")] bool ContentCleaned,
[property: JsonPropertyName("embeddings_cleaned")] bool EmbeddingsCleaned,
[property: JsonPropertyName("summaries_cleaned")] bool SummariesCleaned);
public sealed record AgentRepositoryStatusResult(
[property: JsonPropertyName("repository_id")] string RepositoryId,
[property: JsonPropertyName("repository")] AgentRepositorySummary? Repository,
[property: JsonPropertyName("latest_run")] AgentIngestionRunSummary? LatestRun,
[property: JsonPropertyName("summary_coverage")] AgentNodeSummaryCoverageResult? SummaryCoverage,
[property: JsonPropertyName("counts")] IReadOnlyDictionary<string, JsonElement> Counts,
[property: JsonPropertyName("freshness")] IReadOnlyDictionary<string, JsonElement> Freshness,
[property: JsonPropertyName("refresh")] IReadOnlyDictionary<string, JsonElement> Refresh,
[property: JsonPropertyName("generated_at")] DateTimeOffset GeneratedAt);
public sealed record AgentNodeSummaryProviderModelCount(
[property: JsonPropertyName("provider")] string Provider,
[property: JsonPropertyName("model")] string Model,
[property: JsonPropertyName("prompt_version")] string PromptVersion,
[property: JsonPropertyName("count")] int Count);
public sealed record AgentNodeSummaryCoverageResult(
[property: JsonPropertyName("repository_id")] string RepositoryId,
[property: JsonPropertyName("total_count")] int TotalCount,
[property: JsonPropertyName("completed_count")] int CompletedCount,
[property: JsonPropertyName("failed_count")] int FailedCount,
[property: JsonPropertyName("status_counts")] IReadOnlyDictionary<string, int> StatusCounts,
[property: JsonPropertyName("kind_counts")] IReadOnlyDictionary<string, int> KindCounts,
[property: JsonPropertyName("provider_model_counts")] IReadOnlyDictionary<string, int> ProviderModelCounts,
[property: JsonPropertyName("provider_model_count_details")] IReadOnlyList<AgentNodeSummaryProviderModelCount> ProviderModelCountDetails,
[property: JsonPropertyName("recent_failures")] IReadOnlyList<IReadOnlyDictionary<string, JsonElement>> RecentFailures,
[property: JsonPropertyName("generated_at")] DateTimeOffset GeneratedAt);
public sealed record AgentIngestionRunSummary(
[property: JsonPropertyName("run_id")] string RunId,
[property: JsonPropertyName("repository_id")] string RepositoryId,
[property: JsonPropertyName("repository_root")] string RepositoryRoot,
[property: JsonPropertyName("stage")] string Stage,
[property: JsonPropertyName("started_at")] DateTimeOffset? StartedAt,
[property: JsonPropertyName("finished_at")] DateTimeOffset? FinishedAt,
[property: JsonPropertyName("message")] string? Message,
[property: JsonPropertyName("language")] string Language,
[property: JsonPropertyName("parser_name")] string ParserName,
[property: JsonPropertyName("solution_path")] string? SolutionPath,
[property: JsonPropertyName("project_path")] string? ProjectPath,
[property: JsonPropertyName("dry_run")] bool DryRun,
[property: JsonPropertyName("skip_embeddings")] bool SkipEmbeddings,
[property: JsonPropertyName("embedding_provider")] string EmbeddingProvider,
[property: JsonPropertyName("embedding_model")] string EmbeddingModel,
[property: JsonPropertyName("node_count")] int NodeCount,
[property: JsonPropertyName("relationship_count")] int RelationshipCount,
[property: JsonPropertyName("content_count")] int ContentCount,
[property: JsonPropertyName("embedding_count")] int EmbeddingCount,
[property: JsonPropertyName("stats")] IReadOnlyDictionary<string, JsonElement>? Stats,
[property: JsonPropertyName("diagnostic_count")] int DiagnosticCount,
[property: JsonPropertyName("error_diagnostic_count")] int ErrorDiagnosticCount,
[property: JsonPropertyName("warning_diagnostic_count")] int WarningDiagnosticCount,
[property: JsonPropertyName("metadata")] IReadOnlyDictionary<string, string>? Metadata);
public sealed record AgentIngestionRunListResult(
[property: JsonPropertyName("runs")] IReadOnlyList<AgentIngestionRunSummary> Runs);