openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
164 lines • 6.38 kB
TypeScript
import { a as ModelApi, c as ModelMediaInputConfig, o as ModelCompatConfig, r as OpenClawConfig } from "./types.openclaw-BdCLfP4c.js";
import { _ as ThinkingLevelMap } from "./types-DnOM6PIM.js";
import { k as ModelCatalogStatus, t as PluginManifestRecord } from "./manifest-registry.types-DU8vtPoi.js";
import "./manifest-registry-CGQXX9hG.js";
import { n as PluginMetadataSnapshot } from "./plugin-metadata-snapshot.types-clrjejix.js";
//#region src/plugins/provider-catalog-outcome.d.ts
type ProviderCatalogOutcome = {
provider: string;
/** Auth profile tested by discovery; omission means provider-wide auth. */
profileId?: string;
/** Limits an auth rejection to catalog discovery rather than model execution. */
rejectionScope?: "catalog";
status: "ready" | "auth-rejected" | "unavailable";
};
//#endregion
//#region src/agents/model-catalog.types.d.ts
/** Input modalities a catalog entry can advertise. */
type ModelInputType = "text" | "image" | "audio" | "video" | "document";
type ModelContextWindowOption = {
id: string;
label: string;
contextWindow: number;
};
/** Normalized model metadata exposed by the agent model catalog. */
type ModelCatalogEntry = {
/** Native catalog owner, not a physical provider route or transferable readiness fact. */
nativeRuntime?: string;
id: string;
name: string;
provider: string;
/** Provider-owned strongest-first picker order; internal and never projected to clients. */
providerOrder?: number;
alias?: string;
api?: ModelApi;
/** Private transport provenance for route matching; never project directly to clients. */
baseUrl?: string;
contextWindow?: number;
contextWindows?: ModelContextWindowOption[];
contextWindowDefault?: string;
contextTokens?: number;
reasoning?: boolean;
/** Config-authored reasoning override; internal provenance, never project to clients. */
configuredReasoning?: boolean;
/** Concrete runtime owner of thinking policy; internal and never project to clients. */
thinkingPolicyProvider?: string;
/** Provider-owned effort support for this exact physical model route. */
thinkingLevelMap?: ThinkingLevelMap;
input?: ModelInputType[];
params?: Record<string, unknown>;
compat?: ModelCompatConfig;
mediaInput?: ModelMediaInputConfig;
status?: ModelCatalogStatus;
statusReason?: string;
replaces?: string[];
replacedBy?: string;
};
/** Logical catalog rows plus the physical variants used for route selection. */
type ModelCatalogSnapshot = {
entries: ModelCatalogEntry[];
routeVariants: ModelCatalogEntry[];
/** Provider-owned outcome of each live catalog request in this generation. */
providerOutcomes?: readonly ProviderCatalogOutcome[];
/** Static provider-hook rows captured alongside the full lifecycle generation. */
staticEntries?: ModelCatalogEntry[];
/**
* `false` only when this snapshot came from a degraded load (discovery threw,
* static or empty fallback). Absent/`true` means authoritative — consumers that
* destroy durable state (e.g. resetting a pinned model override) must treat only
* an explicit `false` as degraded, so unrelated hand-built snapshots stay safe.
*/
authoritative?: boolean;
};
//#endregion
//#region src/plugins/manifest-model-id-normalization.d.ts
/** Caller-owned declarations or facts from an already selected metadata snapshot. */
type ManifestModelIdNormalizationSource = readonly Pick<PluginManifestRecord, "modelIdNormalization">[] | {
owners: Pick<PluginMetadataSnapshot["owners"], "modelIdNormalizationPolicies">;
};
//#endregion
//#region src/agents/model-ref-shared.d.ts
type ModelRef = {
provider: string;
model: string;
};
type ModelManifestNormalizationContext = {
manifestPlugins?: ManifestModelIdNormalizationSource;
};
//#endregion
//#region src/agents/model-selection-shared.d.ts
type ModelManifestPlugins = ModelManifestNormalizationContext["manifestPlugins"];
type ModelAliasIndex = {
byAlias: Map<string, {
alias: string;
ref: ModelRef;
}>;
byProviderAlias?: Map<string, {
alias: string;
ref: ModelRef;
}>;
byKey: Map<string, string[]>;
disabledKeys?: Set<string>;
};
type BuildModelAliasIndexParams = {
cfg: OpenClawConfig;
defaultProvider: string;
agentId?: string;
allowManifestNormalization?: boolean;
allowPluginNormalization?: boolean;
} & ModelManifestNormalizationContext;
/** Build lookup maps from user-facing aliases to normalized model refs. */
declare function buildModelAliasIndex(params: BuildModelAliasIndexParams): ModelAliasIndex;
declare function resolveModelRefFromString(params: {
cfg?: OpenClawConfig;
agentId?: string;
raw: string;
defaultProvider: string;
aliasIndex?: ModelAliasIndex;
allowManifestNormalization?: boolean;
allowPluginNormalization?: boolean;
} & ModelManifestNormalizationContext): {
ref: ModelRef;
alias?: string;
} | null;
/** Build catalog entries from configured provider model rows. */
declare function buildConfiguredModelCatalog(params: {
cfg: OpenClawConfig;
workspaceDir?: string;
manifestPlugins?: ModelManifestPlugins;
}): ModelCatalogEntry[];
type ModelVisibilityPolicy = {
allowAny: boolean;
allowedCatalog: ModelCatalogEntry[];
allowedKeys: Set<string>;
policyAliasIndex: ModelAliasIndex;
selectionAliasIndex: ModelAliasIndex;
configuredKeys: ReadonlySet<string>;
retainedKeys: ReadonlySet<string>;
exactModelRefs: readonly string[];
providerWildcards: ReadonlySet<string>;
hasConfiguredEntries: boolean;
hasProviderWildcards: boolean;
allowConfigPath?: string | null;
allowRepairConfigPath: string;
allowsKey: (key: string) => boolean;
allows: (ref: {
provider: string;
model: string;
}) => boolean;
allowsByWildcard: (ref: {
provider: string;
model: string;
}) => boolean;
resolveSelection: (ref: {
provider: string;
model: string;
}) => ModelRef | null;
visibleCatalog: (params: {
catalog: readonly ModelCatalogEntry[];
defaultVisibleCatalog: readonly ModelCatalogEntry[];
view?: "default" | "configured" | "all";
}) => ModelCatalogEntry[];
};
//#endregion
export { ModelManifestNormalizationContext as a, ModelCatalogSnapshot as c, resolveModelRefFromString as i, ProviderCatalogOutcome as l, buildConfiguredModelCatalog as n, ModelRef as o, buildModelAliasIndex as r, ModelCatalogEntry as s, ModelVisibilityPolicy as t };