File size: 21,625 Bytes
46d70d9 b1bc2dc 46d70d9 b1bc2dc 46d70d9 b1bc2dc 46d70d9 | 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 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | import type {
AtlasBinaryData,
BaselineCheckResponse,
BaselineContract,
BootstrapProbesResponse,
CalibrationExportSummary,
ChunkingExportSummary,
ChunkStrategyConfig,
CorpusHygieneRequest,
CorpusHygieneResponse,
CorpusQuickFindResponse,
CuratedModel,
CuratedReranker,
DocumentDetail,
ExportResponse,
FacetQueryRequest,
FacetQueryResponse,
FixFinderResponse,
FixStackExportSummary,
FixStackRequest,
FixStackResponse,
ForensicDiffResponse,
FunnelExportSummary,
HardwareInfo,
HFDatasetSearchResponse,
HFInspectResponse,
HFModelSearchResponse,
HygieneExportSummary,
IndexPrecomputedMetadata,
IndexRunRequest,
LabelPoolResponse,
LassoResponse,
PrepareSliceRequest,
PrepareSliceResponse,
QueryAblationResponse,
RegressionGatePolicy,
RerankExportSummary,
RootCauseCallout,
RoutingExportSummary,
RunCompareRequest,
RunCompareResponse,
RunManifest,
SampleQuestionItem,
SearchRequest,
SearchResponse,
StarterPreset,
StressTestResponse,
SuiteAutoTuneResponse,
SuiteCalibrateResponse,
SuiteChunkSimResponse,
SuiteEvaluateResponse,
SuiteFunnelResponse,
SuiteMetrics,
SuiteRerankRequest,
SuiteRerankResponse,
SuiteRoutingResponse,
SuiteTriageResponse,
SuiteVocabScanResponse,
SuiteVocabVerifyResponse,
TokenSaliencyResponse,
TriageExportSummary,
VocabExportSummary,
VocabRule,
WhatIfDocResponse,
} from "../types/ostra";
const API_BASE = "";
async function requestJson<T>(url: string, init?: RequestInit): Promise<T> {
const res = await fetch(`${API_BASE}${url}`, {
...init,
headers: {
"Content-Type": "application/json",
...(init?.headers ?? {}),
},
});
if (!res.ok) {
let msg = `HTTP ${res.status}`;
const text = await res.text(); // a body can only be read once
try {
const err = JSON.parse(text);
msg = typeof err.detail === "string" ? err.detail : JSON.stringify(err.detail ?? err);
} catch {
if (text) msg = text;
}
throw new Error(msg);
}
return res.json() as Promise<T>;
}
export async function fetchHardwareBootstrap(): Promise<{
hardware: HardwareInfo;
models: CuratedModel[];
rerankers: CuratedReranker[];
presets: StarterPreset[];
}> {
return requestJson("/api/hardware");
}
export async function searchHFDatasets(
query: string,
limit = 12
): Promise<HFDatasetSearchResponse> {
const params = new URLSearchParams({
q: query.trim(),
limit: String(limit),
});
return requestJson(`/api/hf/datasets/search?${params.toString()}`);
}
export async function searchHFModels(
query: string,
task: "embedding" | "reranker",
limit = 15
): Promise<HFModelSearchResponse> {
const params = new URLSearchParams({
q: query.trim(),
task,
limit: String(limit),
});
return requestJson(`/api/hf/models/search?${params.toString()}`);
}
export async function inspectHFDataset(payload: {
dataset_id: string;
config?: string | null;
split?: string | null;
}): Promise<HFInspectResponse> {
return requestJson("/api/hf/inspect", {
method: "POST",
body: JSON.stringify(payload),
});
}
export async function listProjects(): Promise<RunManifest[]> {
return requestJson("/api/projects");
}
export async function deleteProject(runId: string): Promise<void> {
await requestJson(`/api/projects/${encodeURIComponent(runId)}`, {
method: "DELETE",
});
}
export async function fetchAtlasBinary(runId: string): Promise<AtlasBinaryData> {
const res = await fetch(
`${API_BASE}/api/projects/${encodeURIComponent(runId)}/atlas-binary`
);
if (!res.ok) {
throw new Error(`Failed to fetch atlas binary (${res.status})`);
}
const stride = Number(res.headers.get("X-Ostra-Stride-Floats") || "8");
const buf = await res.arrayBuffer();
const raw = new Float32Array(buf);
return {
count: Math.floor(raw.length / stride),
stride,
raw,
};
}
export async function fetchDocDetail(
runId: string,
docId: number
): Promise<DocumentDetail> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/docs/${docId}`);
}
export async function inspectLasso(
runId: string,
polygon: [number, number][]
): Promise<LassoResponse> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/lasso`, {
method: "POST",
body: JSON.stringify({ polygon }),
});
}
export async function queryFacetsApi(
runId: string,
req: FacetQueryRequest
): Promise<FacetQueryResponse> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/facets`, {
method: "POST",
body: JSON.stringify(req),
});
}
export interface IndexProgressEvent {
stage: string;
message: string;
percent: number;
done?: number;
total?: number;
docs_per_sec?: number;
truncated_count?: number;
device?: string;
backend?: string;
}
export async function streamIndexRun(
req: IndexRunRequest,
onProgress: (ev: IndexProgressEvent) => void
): Promise<RunManifest> {
const res = await fetch(`${API_BASE}/api/projects/index`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(req),
});
if (!res.ok || !res.body) {
throw new Error(`Indexing request failed (${res.status})`);
}
const reader = res.body.getReader();
const decoder = new TextDecoder();
let buffer = "";
let finalManifest: RunManifest | null = null;
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const chunks = buffer.split("\n\n");
buffer = chunks.pop() || "";
for (const chunk of chunks) {
const lines = chunk.split("\n");
let eventType = "message";
let dataStr = "";
for (const line of lines) {
if (line.startsWith("event:")) {
eventType = line.slice(6).trim();
} else if (line.startsWith("data:")) {
dataStr += line.slice(5).trim();
}
}
if (!dataStr) continue;
const parsed = JSON.parse(dataStr);
if (eventType === "progress") {
onProgress(parsed as IndexProgressEvent);
} else if (eventType === "complete") {
finalManifest = parsed.manifest as RunManifest;
} else if (eventType === "error") {
throw new Error(parsed.message || "Indexing error");
}
}
}
if (!finalManifest) {
throw new Error("Indexing stream ended without completion event.");
}
return finalManifest;
}
export async function prepareHFSlice(
payload: PrepareSliceRequest
): Promise<PrepareSliceResponse> {
return requestJson("/api/projects/prepare-slice", {
method: "POST",
body: JSON.stringify(payload),
});
}
export async function streamIndexPrecomputedRun(
meta: IndexPrecomputedMetadata,
embeddings: Float32Array,
onProgress: (ev: IndexProgressEvent) => void
): Promise<RunManifest> {
// Pack as a single raw binary stream: [uint32_le metaLen][utf8 metaJSON][float32 embeddings].
// Completely bypasses multipart form parsers and Starlette's 1024KB part-size limits.
const metaBytes = new TextEncoder().encode(JSON.stringify(meta));
const embCopy = new Uint8Array(
embeddings.buffer,
embeddings.byteOffset,
embeddings.byteLength
).slice();
const header = new ArrayBuffer(4);
new DataView(header).setUint32(0, metaBytes.byteLength, true);
const payload = new Blob([header, metaBytes, embCopy], {
type: "application/octet-stream",
});
const res = await fetch(`${API_BASE}/api/projects/index-precomputed`, {
method: "POST",
headers: { "Content-Type": "application/octet-stream" },
body: payload,
});
if (!res.ok || !res.body) {
const text = await res.text();
throw new Error(text || `Precomputed indexing failed (${res.status})`);
}
const reader = res.body.getReader();
const decoder = new TextDecoder();
let buffer = "";
let finalManifest: RunManifest | null = null;
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const chunks = buffer.split("\n\n");
buffer = chunks.pop() || "";
for (const chunk of chunks) {
const lines = chunk.split("\n");
let eventType = "message";
let dataStr = "";
for (const line of lines) {
if (line.startsWith("event:")) {
eventType = line.slice(6).trim();
} else if (line.startsWith("data:")) {
dataStr += line.slice(5).trim();
}
}
if (!dataStr) continue;
const parsed = JSON.parse(dataStr);
if (eventType === "progress") {
onProgress(parsed as IndexProgressEvent);
} else if (eventType === "complete") {
finalManifest = parsed.manifest as RunManifest;
} else if (eventType === "error") {
throw new Error(parsed.message || "Indexing finalization error");
}
}
}
if (!finalManifest) {
throw new Error("Finalization stream ended without completion event.");
}
return finalManifest;
}
export async function runHybridSearchApi(
runId: string,
req: SearchRequest,
signal?: AbortSignal
): Promise<SearchResponse> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/search`, {
method: "POST",
body: JSON.stringify(req),
signal,
});
}
export async function fetchForensicDiff(
runId: string,
search: SearchRequest,
docAId: number,
docBId: number
): Promise<ForensicDiffResponse> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/forensic-diff`, {
method: "POST",
body: JSON.stringify({
search,
doc_a_id: docAId,
doc_b_id: docBId,
}),
});
}
export async function fetchTokenSaliency(
runId: string,
payload: {
query: string;
doc_id: number;
query_prefix_override?: string | null;
abtt_d?: number;
mean_center?: boolean;
}
): Promise<TokenSaliencyResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/token-saliency`,
{
method: "POST",
body: JSON.stringify(payload),
}
);
}
export async function runStressTest(
runId: string,
search: SearchRequest
): Promise<StressTestResponse> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/stress-test`, {
method: "POST",
body: JSON.stringify({ search }),
});
}
export async function fetchSuite(runId: string): Promise<SampleQuestionItem[]> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/suite`);
}
export async function saveSuiteApi(
runId: string,
items: SampleQuestionItem[]
): Promise<SampleQuestionItem[]> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/suite`, {
method: "PUT",
body: JSON.stringify(items),
});
}
export async function bootstrapSuiteProbesApi(
runId: string,
count: number = 12,
existingQueries: string[] = []
): Promise<BootstrapProbesResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/bootstrap-probes`,
{
method: "POST",
body: JSON.stringify({
count,
existing_queries: existingQueries,
}),
}
);
}
export async function fetchLabelPoolApi(
runId: string,
params: {
query: string;
search: SearchRequest;
draft_source_doc_id?: number | null;
existing_expected_doc_ids?: number[];
max_candidates?: number;
}
): Promise<LabelPoolResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/label-pool`,
{
method: "POST",
body: JSON.stringify({
query: params.query,
search: params.search,
draft_source_doc_id: params.draft_source_doc_id ?? null,
existing_expected_doc_ids: params.existing_expected_doc_ids ?? [],
max_candidates: params.max_candidates ?? 8,
}),
}
);
}
export async function quickFindCorpusDocsApi(
runId: string,
params: {
query: string;
limit?: number;
exclude_doc_ids?: number[];
}
): Promise<CorpusQuickFindResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/corpus-find`,
{
method: "POST",
body: JSON.stringify({
query: params.query,
limit: params.limit ?? 6,
exclude_doc_ids: params.exclude_doc_ids ?? [],
}),
}
);
}
export async function evaluateSuiteApi(
runId: string,
questions: SampleQuestionItem[],
search: SearchRequest,
baselineSearch: SearchRequest | null
): Promise<SuiteEvaluateResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/evaluate`,
{
method: "POST",
body: JSON.stringify({
questions,
search,
baseline_search: baselineSearch,
}),
}
);
}
export async function triageSuiteApi(
runId: string,
questions: SampleQuestionItem[],
search: SearchRequest
): Promise<SuiteTriageResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/triage`,
{
method: "POST",
body: JSON.stringify({ questions, search }),
}
);
}
export async function analyzeSuiteFunnelApi(
runId: string,
questions: SampleQuestionItem[],
search: SearchRequest,
rerankK: number | null = null
): Promise<SuiteFunnelResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/funnel`,
{
method: "POST",
body: JSON.stringify({
questions,
search,
...(rerankK !== null ? { rerank_k: rerankK } : {}),
}),
}
);
}
export async function analyzeSuiteRoutingApi(
runId: string,
items: SampleQuestionItem[],
baseSearch: SearchRequest
): Promise<SuiteRoutingResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/routing-lab`,
{
method: "POST",
body: JSON.stringify({
items,
base_search: baseSearch,
}),
}
);
}
export async function simulateSuiteChunkingApi(
runId: string,
questions: SampleQuestionItem[],
search: SearchRequest,
customStrategy: ChunkStrategyConfig | null = null
): Promise<SuiteChunkSimResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/chunk-sim`,
{
method: "POST",
body: JSON.stringify({
questions,
search,
...(customStrategy !== null ? { custom_strategy: customStrategy } : {}),
}),
}
);
}
export async function getVocabRulesApi(runId: string): Promise<VocabRule[]> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/vocab-rules`);
}
export async function saveVocabRulesApi(
runId: string,
rules: VocabRule[]
): Promise<VocabRule[]> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/vocab-rules`, {
method: "PUT",
body: JSON.stringify(rules),
});
}
export async function scanSuiteVocabApi(
runId: string,
questions: SampleQuestionItem[],
search: SearchRequest,
rules: VocabRule[] = []
): Promise<SuiteVocabScanResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/vocab-scan`,
{
method: "POST",
body: JSON.stringify({ questions, search, rules }),
}
);
}
export async function verifySuiteVocabApi(
runId: string,
questions: SampleQuestionItem[],
search: SearchRequest,
rules: VocabRule[]
): Promise<SuiteVocabVerifyResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/vocab-verify`,
{
method: "POST",
body: JSON.stringify({ questions, search, rules }),
}
);
}
export async function calibrateSuiteApi(
runId: string,
questions: SampleQuestionItem[],
search: SearchRequest
): Promise<SuiteCalibrateResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/calibrate`,
{
method: "POST",
body: JSON.stringify({ questions, search }),
}
);
}
export async function compareRunsApi(
payload: RunCompareRequest
): Promise<RunCompareResponse> {
return requestJson("/api/projects/compare-runs", {
method: "POST",
body: JSON.stringify(payload),
});
}
export async function analyzeCorpusHygieneApi(
runId: string,
payload: CorpusHygieneRequest
): Promise<CorpusHygieneResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/corpus-hygiene`,
{
method: "POST",
body: JSON.stringify(payload),
}
);
}
export async function compileFixStackApi(
runId: string,
payload: FixStackRequest
): Promise<FixStackResponse> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/suite/fix-stack`, {
method: "POST",
body: JSON.stringify(payload),
});
}
export async function analyzeSuiteRerankApi(
runId: string,
payload: SuiteRerankRequest
): Promise<SuiteRerankResponse> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/suite/rerank-lab`, {
method: "POST",
body: JSON.stringify(payload),
});
}
export async function exportRecipeApi(
runId: string,
search: SearchRequest,
suiteMetrics: SuiteMetrics | null,
callouts: RootCauseCallout[],
triageSummary: TriageExportSummary | null = null,
calibrationSummary: CalibrationExportSummary | null = null,
funnelSummary: FunnelExportSummary | null = null,
chunkingSummary: ChunkingExportSummary | null = null,
vocabSummary: VocabExportSummary | null = null,
routingSummary: RoutingExportSummary | null = null,
hygieneSummary: HygieneExportSummary | null = null,
fixStackSummary: FixStackExportSummary | null = null,
rerankSummary: RerankExportSummary | null = null
): Promise<ExportResponse> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/export`, {
method: "POST",
body: JSON.stringify({
search,
suite_metrics: suiteMetrics,
callouts,
triage_summary: triageSummary,
calibration_summary: calibrationSummary,
funnel_summary: funnelSummary,
chunking_summary: chunkingSummary,
vocab_summary: vocabSummary,
routing_summary: routingSummary,
hygiene_summary: hygieneSummary,
fix_stack_summary: fixStackSummary,
rerank_summary: rerankSummary,
}),
});
}
export async function findCounterfactualFixesApi(
runId: string,
search: SearchRequest,
targetDocId: number,
suiteQuestions: SampleQuestionItem[] = []
): Promise<FixFinderResponse> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/find-fixes`, {
method: "POST",
body: JSON.stringify({
search,
target_doc_id: targetDocId,
suite_questions: suiteQuestions,
}),
});
}
export async function fetchQueryAblationApi(
runId: string,
search: SearchRequest,
docId: number
): Promise<QueryAblationResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/query-ablation`,
{
method: "POST",
body: JSON.stringify({ search, doc_id: docId }),
}
);
}
export async function runWhatIfDocApi(
runId: string,
payload: {
search: SearchRequest;
doc_id: number;
edited_fields?: Record<string, string> | null;
edited_text?: string | null;
simulate_chunking?: boolean;
chunk_words?: number;
chunk_overlap?: number;
}
): Promise<WhatIfDocResponse> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/what-if-doc`, {
method: "POST",
body: JSON.stringify(payload),
});
}
export async function autoTuneSuiteApi(
runId: string,
questions: SampleQuestionItem[],
search: SearchRequest
): Promise<SuiteAutoTuneResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/suite/auto-tune`,
{
method: "POST",
body: JSON.stringify({ questions, search }),
}
);
}
export type ClusterGranularity = "coarse" | "balanced" | "fine" | "pinpoint";
export async function reclusterRunApi(
runId: string,
payload: {
granularity: ClusterGranularity;
focus_cluster_id?: number | null;
sub_clusters?: number;
}
): Promise<RunManifest> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/recluster`, {
method: "POST",
body: JSON.stringify(payload),
});
}
export async function getBaselineApi(
runId: string
): Promise<BaselineContract | null> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/baseline`);
}
export async function pinBaselineApi(
runId: string,
payload: {
label?: string;
questions?: SampleQuestionItem[] | null;
search: SearchRequest;
policy?: RegressionGatePolicy | null;
}
): Promise<BaselineContract> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/baseline/pin`,
{
method: "POST",
body: JSON.stringify(payload),
}
);
}
export async function updateBaselinePolicyApi(
runId: string,
policy: RegressionGatePolicy
): Promise<BaselineContract> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/baseline/policy`,
{
method: "PUT",
body: JSON.stringify({ policy }),
}
);
}
export async function deleteBaselineApi(
runId: string
): Promise<{ ok: boolean }> {
return requestJson(`/api/projects/${encodeURIComponent(runId)}/baseline`, {
method: "DELETE",
});
}
export async function checkBaselineApi(
runId: string,
payload: {
search: SearchRequest;
contract?: BaselineContract | null;
policy_override?: RegressionGatePolicy | null;
current_suite_hash?: string | null;
}
): Promise<BaselineCheckResponse> {
return requestJson(
`/api/projects/${encodeURIComponent(runId)}/baseline/check`,
{
method: "POST",
body: JSON.stringify(payload),
}
);
}
|