stela ops usage fixes roles propagation and timoeut, one account to support multi tenants, migrations consolidation, search to support documentation, doctor and open api vector db search

This commit is contained in:
master
2026-02-22 19:27:54 +02:00
parent a29f438f53
commit bd8fee6ed8
373 changed files with 832097 additions and 3369 deletions

View File

@@ -0,0 +1,164 @@
using System.Collections.Immutable;
using System.Text.Json;
namespace StellaOps.AdvisoryAI.KnowledgeSearch;
public sealed record KnowledgeSearchRequest(
string Q,
int? K = null,
KnowledgeSearchFilter? Filters = null,
bool IncludeDebug = false);
public sealed record KnowledgeSearchFilter
{
public IReadOnlyList<string>? Type { get; init; }
public string? Product { get; init; }
public string? Version { get; init; }
public string? Service { get; init; }
public IReadOnlyList<string>? Tags { get; init; }
}
public sealed record KnowledgeSearchResponse(
string Query,
int TopK,
IReadOnlyList<KnowledgeSearchResult> Results,
KnowledgeSearchDiagnostics Diagnostics);
public sealed record KnowledgeSearchResult(
string Type,
string Title,
string Snippet,
double Score,
KnowledgeOpenAction Open,
IReadOnlyDictionary<string, string>? Debug = null);
public sealed record KnowledgeOpenAction(
KnowledgeOpenActionType Kind,
KnowledgeOpenDocAction? Docs = null,
KnowledgeOpenApiAction? Api = null,
KnowledgeOpenDoctorAction? Doctor = null);
public enum KnowledgeOpenActionType
{
Docs = 1,
Api = 2,
Doctor = 3
}
public sealed record KnowledgeOpenDocAction(
string Path,
string Anchor,
int SpanStart,
int SpanEnd);
public sealed record KnowledgeOpenApiAction(
string Service,
string Method,
string Path,
string OperationId);
public sealed record KnowledgeOpenDoctorAction(
string CheckCode,
string Severity,
bool CanRun,
string RunCommand);
public sealed record KnowledgeSearchDiagnostics(
int FtsMatches,
int VectorMatches,
long DurationMs,
bool UsedVector,
string Mode);
internal sealed record KnowledgeSourceDocument(
string DocId,
string DocType,
string Product,
string Version,
string SourceRef,
string Path,
string Title,
string ContentHash,
JsonDocument Metadata);
internal sealed record KnowledgeChunkDocument(
string ChunkId,
string DocId,
string Kind,
string? Anchor,
string? SectionPath,
int SpanStart,
int SpanEnd,
string Title,
string Body,
float[]? Embedding,
JsonDocument Metadata);
internal sealed record KnowledgeApiSpec(
string SpecId,
string DocId,
string Service,
string? OpenApiVersion,
string? Title,
string? Version,
string SourcePath,
JsonDocument Content);
internal sealed record KnowledgeApiOperation(
string OperationKey,
string SpecId,
string ChunkId,
string Service,
string Method,
string Path,
string? OperationId,
IReadOnlyList<string> Tags,
string? Summary,
JsonDocument RequestJson,
JsonDocument ResponsesJson,
JsonDocument SecurityJson);
internal sealed record KnowledgeDoctorProjection(
string CheckCode,
string ChunkId,
string Title,
string Severity,
string Remediation,
string RunCommand,
IReadOnlyList<string> Symptoms,
JsonDocument ReferencesJson,
JsonDocument MetadataJson);
internal sealed record KnowledgeIndexSnapshot(
IReadOnlyList<KnowledgeSourceDocument> Documents,
IReadOnlyList<KnowledgeChunkDocument> Chunks,
IReadOnlyList<KnowledgeApiSpec> ApiSpecs,
IReadOnlyList<KnowledgeApiOperation> ApiOperations,
IReadOnlyList<KnowledgeDoctorProjection> DoctorProjections);
public sealed record KnowledgeRebuildSummary(
int DocumentCount,
int ChunkCount,
int ApiSpecCount,
int ApiOperationCount,
int DoctorProjectionCount,
long DurationMs);
internal sealed record KnowledgeChunkRow(
string ChunkId,
string DocId,
string Kind,
string? Anchor,
string? SectionPath,
int SpanStart,
int SpanEnd,
string Title,
string Body,
string Snippet,
JsonDocument Metadata,
float[]? Embedding,
double LexicalScore);