mirror of
https://github.com/volcengine/OpenViking.git
synced 2026-09-28 11:43:00 +08:00
* fix(plugins): honor cloud recall compression across harnesses * chore(plugins): bump versions for cloud recall support * fix(dsh): align runtime and package versions * test(plugins): derive installed version from the manifest * refactor(plugins): route Codex recall through the shared pipeline
87 lines
2.3 KiB
TypeScript
87 lines
2.3 KiB
TypeScript
import type { OvHttpRequestOptions } from "./ov-http.mjs";
|
|
|
|
export type ContextSearchBody = {
|
|
query: string;
|
|
mode: "context";
|
|
purpose: "coding";
|
|
score_threshold: number;
|
|
quotas?: Record<string, number>;
|
|
max_tokens?: number;
|
|
peer_scope?: "actor";
|
|
session_id?: string;
|
|
query_expansion?: "off" | "auto";
|
|
dedup_turns?: number;
|
|
exclude_uris?: string[];
|
|
rewrite?: boolean | "auto";
|
|
rewrite_max_bullets?: number;
|
|
};
|
|
|
|
export type NormalizedContextEntry = {
|
|
uri: string;
|
|
category: string;
|
|
detail: string;
|
|
score: number;
|
|
text: string;
|
|
};
|
|
|
|
export function buildContextSearchBody(
|
|
cfg?: Record<string, unknown>,
|
|
options?: {
|
|
sessionId?: string;
|
|
excludeUris?: string[];
|
|
localCompressorAvailable?: boolean;
|
|
},
|
|
): ContextSearchBody;
|
|
|
|
export function contextRequestTimeoutMs(
|
|
cfg?: Record<string, unknown>,
|
|
body?: Record<string, unknown>,
|
|
): number | undefined;
|
|
|
|
export function normalizeContextEntry(entry?: unknown): NormalizedContextEntry;
|
|
|
|
export type RecallFetchJSON = (
|
|
path: string,
|
|
init?: RequestInit,
|
|
options?: OvHttpRequestOptions,
|
|
) => Promise<{ ok: boolean; status?: number; result?: any; error?: any }>;
|
|
|
|
export type RecallOptions = {
|
|
actorPeerId?: string;
|
|
legacyPeerId?: string;
|
|
sessionId?: string;
|
|
log?: (stage: string, data?: any) => void;
|
|
localCompressorAvailable?: boolean;
|
|
runCompressor?: ((prompt: string) => Promise<string | null>) | null;
|
|
digestCachePath?: string;
|
|
legacyCachePath?: string;
|
|
};
|
|
|
|
export type DetailedRecall = {
|
|
block: string;
|
|
contentCount: number;
|
|
hintCount: number;
|
|
budgetUsed: number;
|
|
stage: "server_assembled" | "ranked" | "no_results" | "filtered_out";
|
|
};
|
|
|
|
export function buildRecallBlockDetailed(
|
|
fetchJSON: RecallFetchJSON,
|
|
cfg: Record<string, any>,
|
|
query: string,
|
|
options?: RecallOptions,
|
|
): Promise<DetailedRecall>;
|
|
|
|
export function buildRecallBlock(
|
|
fetchJSON: RecallFetchJSON,
|
|
cfg: Record<string, any>,
|
|
query: string,
|
|
options?: RecallOptions,
|
|
): Promise<string | null>;
|
|
|
|
export function buildRecallEndpointBody(cfg?: Record<string, any>): Record<string, any>;
|
|
export function estimateTokens(text: string): number;
|
|
export function isRecallEnabled(cfg?: Record<string, any>): boolean;
|
|
|
|
export function selectRecallContent(result?: { rendered?: string; digest?: string; stats?: Record<string, unknown> }): string;
|