@cerebriline/llms 0.0.0-stage → 4.100.240
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +15 -2
- package/dist/catalog/catalog-cline-recommended.d.ts +14 -0
- package/dist/catalog/catalog-cline-recommended.d.ts.map +1 -0
- package/dist/catalog/catalog-live.d.ts +64 -0
- package/dist/catalog/catalog-live.d.ts.map +1 -0
- package/dist/catalog/catalog.generated-access.d.ts +5 -0
- package/dist/catalog/catalog.generated-access.d.ts.map +1 -0
- package/dist/catalog/catalog.generated.d.ts +17 -0
- package/dist/catalog/catalog.generated.d.ts.map +1 -0
- package/dist/catalog/model-filters.d.ts +9 -0
- package/dist/catalog/model-filters.d.ts.map +1 -0
- package/dist/catalog/model-id-aliases.d.ts +11 -0
- package/dist/catalog/model-id-aliases.d.ts.map +1 -0
- package/dist/catalog/model-operation.d.ts +27 -0
- package/dist/catalog/model-operation.d.ts.map +1 -0
- package/dist/catalog/types.d.ts +367 -0
- package/dist/catalog/types.d.ts.map +1 -0
- package/dist/index.browser.d.ts +12 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.js +16 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +272 -0
- package/dist/models.d.ts +10 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +241 -0
- package/dist/providers/agent-slots.d.ts +100 -0
- package/dist/providers/agent-slots.d.ts.map +1 -0
- package/dist/providers/ai-sdk.d.ts +158 -0
- package/dist/providers/ai-sdk.d.ts.map +1 -0
- package/dist/providers/async.d.ts +2 -0
- package/dist/providers/async.d.ts.map +1 -0
- package/dist/providers/billing.d.ts +5 -0
- package/dist/providers/billing.d.ts.map +1 -0
- package/dist/providers/builtin-types.d.ts +34 -0
- package/dist/providers/builtin-types.d.ts.map +1 -0
- package/dist/providers/builtins-runtime.d.ts +3 -0
- package/dist/providers/builtins-runtime.d.ts.map +1 -0
- package/dist/providers/builtins.d.ts +30 -0
- package/dist/providers/builtins.d.ts.map +1 -0
- package/dist/providers/compat.d.ts +75 -0
- package/dist/providers/compat.d.ts.map +1 -0
- package/dist/providers/config.d.ts +521 -0
- package/dist/providers/config.d.ts.map +1 -0
- package/dist/providers/error-classification.d.ts +23 -0
- package/dist/providers/error-classification.d.ts.map +1 -0
- package/dist/providers/errors.d.ts +33 -0
- package/dist/providers/errors.d.ts.map +1 -0
- package/dist/providers/factory-registry.d.ts +92 -0
- package/dist/providers/factory-registry.d.ts.map +1 -0
- package/dist/providers/format.d.ts +2 -0
- package/dist/providers/format.d.ts.map +1 -0
- package/dist/providers/gateway.d.ts +123 -0
- package/dist/providers/gateway.d.ts.map +1 -0
- package/dist/providers/handler.d.ts +75 -0
- package/dist/providers/handler.d.ts.map +1 -0
- package/dist/providers/http.d.ts +10 -0
- package/dist/providers/http.d.ts.map +1 -0
- package/dist/providers/ids.d.ts +77 -0
- package/dist/providers/ids.d.ts.map +1 -0
- package/dist/providers/messages.d.ts +5 -0
- package/dist/providers/messages.d.ts.map +1 -0
- package/dist/providers/middleware/backoff.d.ts +11 -0
- package/dist/providers/middleware/backoff.d.ts.map +1 -0
- package/dist/providers/middleware/retry-empty-response.d.ts +74 -0
- package/dist/providers/middleware/retry-empty-response.d.ts.map +1 -0
- package/dist/providers/middleware/retry-rate-limit.d.ts +49 -0
- package/dist/providers/middleware/retry-rate-limit.d.ts.map +1 -0
- package/dist/providers/middleware/split-tool-images.d.ts +32 -0
- package/dist/providers/middleware/split-tool-images.d.ts.map +1 -0
- package/dist/providers/middleware/stream-part-classification.d.ts +33 -0
- package/dist/providers/middleware/stream-part-classification.d.ts.map +1 -0
- package/dist/providers/model-capabilities.d.ts +15 -0
- package/dist/providers/model-capabilities.d.ts.map +1 -0
- package/dist/providers/model-facts.d.ts +115 -0
- package/dist/providers/model-facts.d.ts.map +1 -0
- package/dist/providers/model-operations.d.ts +78 -0
- package/dist/providers/model-operations.d.ts.map +1 -0
- package/dist/providers/model-registry.d.ts +25 -0
- package/dist/providers/model-registry.d.ts.map +1 -0
- package/dist/providers/model-tools.d.ts +22 -0
- package/dist/providers/model-tools.d.ts.map +1 -0
- package/dist/providers/openai-codex-models.d.ts +11 -0
- package/dist/providers/openai-codex-models.d.ts.map +1 -0
- package/dist/providers/provider-ids.generated.d.ts +13 -0
- package/dist/providers/provider-ids.generated.d.ts.map +1 -0
- package/dist/providers/provider-keys.d.ts +13 -0
- package/dist/providers/provider-keys.d.ts.map +1 -0
- package/dist/providers/provider-request-capture.d.ts +10 -0
- package/dist/providers/provider-request-capture.d.ts.map +1 -0
- package/dist/providers/providers.generated.d.ts +19 -0
- package/dist/providers/providers.generated.d.ts.map +1 -0
- package/dist/providers/reasoning-history.d.ts +140 -0
- package/dist/providers/reasoning-history.d.ts.map +1 -0
- package/dist/providers/registry.d.ts +19 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/request-headers.d.ts +30 -0
- package/dist/providers/request-headers.d.ts.map +1 -0
- package/dist/providers/request-timings.d.ts +20 -0
- package/dist/providers/request-timings.d.ts.map +1 -0
- package/dist/providers/routing/anthropic-compatible.d.ts +35 -0
- package/dist/providers/routing/anthropic-compatible.d.ts.map +1 -0
- package/dist/providers/routing/bedrock-cache-point.d.ts +26 -0
- package/dist/providers/routing/bedrock-cache-point.d.ts.map +1 -0
- package/dist/providers/routing/generic-compatible.d.ts +10 -0
- package/dist/providers/routing/generic-compatible.d.ts.map +1 -0
- package/dist/providers/routing/glm-thinking.d.ts +16 -0
- package/dist/providers/routing/glm-thinking.d.ts.map +1 -0
- package/dist/providers/routing/minimax-thinking.d.ts +6 -0
- package/dist/providers/routing/minimax-thinking.d.ts.map +1 -0
- package/dist/providers/routing/portable-reasoning.d.ts +11 -0
- package/dist/providers/routing/portable-reasoning.d.ts.map +1 -0
- package/dist/providers/routing/provider-option-rules.d.ts +13 -0
- package/dist/providers/routing/provider-option-rules.d.ts.map +1 -0
- package/dist/providers/routing/provider-options-types.d.ts +57 -0
- package/dist/providers/routing/provider-options-types.d.ts.map +1 -0
- package/dist/providers/routing/provider-options.d.ts +27 -0
- package/dist/providers/routing/provider-options.d.ts.map +1 -0
- package/dist/providers/routing/reasoning-codecs.d.ts +4 -0
- package/dist/providers/routing/reasoning-codecs.d.ts.map +1 -0
- package/dist/providers/routing/reasoning-options.d.ts +8 -0
- package/dist/providers/routing/reasoning-options.d.ts.map +1 -0
- package/dist/providers/routing/utils.d.ts +31 -0
- package/dist/providers/routing/utils.d.ts.map +1 -0
- package/dist/providers/sdk-warnings.d.ts +14 -0
- package/dist/providers/sdk-warnings.d.ts.map +1 -0
- package/dist/providers/server-health.d.ts +66 -0
- package/dist/providers/server-health.d.ts.map +1 -0
- package/dist/providers/stream.d.ts +124 -0
- package/dist/providers/stream.d.ts.map +1 -0
- package/dist/providers/types.d.ts +10 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/url.d.ts +3 -0
- package/dist/providers/url.d.ts.map +1 -0
- package/dist/providers/utils.d.ts +2 -0
- package/dist/providers/utils.d.ts.map +1 -0
- package/dist/providers/vendors/anthropic.d.ts +4 -0
- package/dist/providers/vendors/anthropic.d.ts.map +1 -0
- package/dist/providers/vendors/bedrock.d.ts +24 -0
- package/dist/providers/vendors/bedrock.d.ts.map +1 -0
- package/dist/providers/vendors/cline.d.ts +37 -0
- package/dist/providers/vendors/cline.d.ts.map +1 -0
- package/dist/providers/vendors/community.d.ts +8 -0
- package/dist/providers/vendors/community.d.ts.map +1 -0
- package/dist/providers/vendors/google.d.ts +12 -0
- package/dist/providers/vendors/google.d.ts.map +1 -0
- package/dist/providers/vendors/llamacpp-sampling.d.ts +130 -0
- package/dist/providers/vendors/llamacpp-sampling.d.ts.map +1 -0
- package/dist/providers/vendors/llamacpp-timings.d.ts +33 -0
- package/dist/providers/vendors/llamacpp-timings.d.ts.map +1 -0
- package/dist/providers/vendors/minimax-thinking.d.ts +5 -0
- package/dist/providers/vendors/minimax-thinking.d.ts.map +1 -0
- package/dist/providers/vendors/mistral.d.ts +4 -0
- package/dist/providers/vendors/mistral.d.ts.map +1 -0
- package/dist/providers/vendors/ollama-account.d.ts +128 -0
- package/dist/providers/vendors/ollama-account.d.ts.map +1 -0
- package/dist/providers/vendors/ollama-reachability.d.ts +42 -0
- package/dist/providers/vendors/ollama-reachability.d.ts.map +1 -0
- package/dist/providers/vendors/ollama-stall-watchdog.d.ts +86 -0
- package/dist/providers/vendors/ollama-stall-watchdog.d.ts.map +1 -0
- package/dist/providers/vendors/ollama-tool-images.d.ts +67 -0
- package/dist/providers/vendors/ollama-tool-images.d.ts.map +1 -0
- package/dist/providers/vendors/ollama.d.ts +256 -0
- package/dist/providers/vendors/ollama.d.ts.map +1 -0
- package/dist/providers/vendors/openai-compatible.d.ts +16 -0
- package/dist/providers/vendors/openai-compatible.d.ts.map +1 -0
- package/dist/providers/vendors/openai.d.ts +4 -0
- package/dist/providers/vendors/openai.d.ts.map +1 -0
- package/dist/providers/vendors/opencoti-agent-window.d.ts +44 -0
- package/dist/providers/vendors/opencoti-agent-window.d.ts.map +1 -0
- package/dist/providers/vendors/opencoti-kv-pressure.d.ts +322 -0
- package/dist/providers/vendors/opencoti-kv-pressure.d.ts.map +1 -0
- package/dist/providers/vendors/opencoti-liveness.d.ts +177 -0
- package/dist/providers/vendors/opencoti-liveness.d.ts.map +1 -0
- package/dist/providers/vendors/opencoti-window.d.ts +56 -0
- package/dist/providers/vendors/opencoti-window.d.ts.map +1 -0
- package/dist/providers/vendors/opencoti.d.ts +335 -0
- package/dist/providers/vendors/opencoti.d.ts.map +1 -0
- package/dist/providers/vendors/polykv-lead.d.ts +94 -0
- package/dist/providers/vendors/polykv-lead.d.ts.map +1 -0
- package/dist/providers/vendors/polykv-swarm.d.ts +705 -0
- package/dist/providers/vendors/polykv-swarm.d.ts.map +1 -0
- package/dist/providers/vendors/polykv.d.ts +958 -0
- package/dist/providers/vendors/polykv.d.ts.map +1 -0
- package/dist/providers/vendors/types.d.ts +176 -0
- package/dist/providers/vendors/types.d.ts.map +1 -0
- package/dist/providers/vendors/vertex.d.ts +4 -0
- package/dist/providers/vendors/vertex.d.ts.map +1 -0
- package/dist/providers/vendors/xollama-engine.d.ts +57 -0
- package/dist/providers/vendors/xollama-engine.d.ts.map +1 -0
- package/dist/providers/vendors/xollama.d.ts +188 -0
- package/dist/providers/vendors/xollama.d.ts.map +1 -0
- package/dist/providers.browser.d.ts +3 -0
- package/dist/providers.browser.d.ts.map +1 -0
- package/dist/providers.browser.js +16 -0
- package/dist/providers.d.ts +12 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +272 -0
- package/dist/services/langfuse-telemetry.d.ts +19 -0
- package/dist/services/langfuse-telemetry.d.ts.map +1 -0
- package/dist/transcription.d.ts +53 -0
- package/dist/transcription.d.ts.map +1 -0
- package/package.json +84 -5
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Configuration Types
|
|
3
|
+
*
|
|
4
|
+
* Unified configuration interface for all providers.
|
|
5
|
+
* This replaces the per-provider config chaos with a single structure.
|
|
6
|
+
*/
|
|
7
|
+
import type { BasicLogger, ExtensionContext, ReasoningEffort, ReasoningHistorySetting } from "@cerebriline/shared";
|
|
8
|
+
import type { ModelInfo, ProviderClient } from "../catalog/types";
|
|
9
|
+
import { BUILT_IN_PROVIDER, BUILT_IN_PROVIDER_IDS, type BuiltInProviderId, isBuiltInProviderId, normalizeProviderId } from "./ids";
|
|
10
|
+
export { BUILT_IN_PROVIDER, BUILT_IN_PROVIDER_IDS, type BuiltInProviderId, isBuiltInProviderId, normalizeProviderId, };
|
|
11
|
+
/**
|
|
12
|
+
* All supported provider IDs (built-in + custom)
|
|
13
|
+
*
|
|
14
|
+
* Custom provider IDs can be registered via `registerHandler()` or `registerAsyncHandler()`.
|
|
15
|
+
* Any string is accepted to allow for custom handlers that extend BaseHandler.
|
|
16
|
+
*/
|
|
17
|
+
export type ProviderId = BuiltInProviderId | (string & {});
|
|
18
|
+
/**
|
|
19
|
+
* Provider categories based on underlying SDK/protocol
|
|
20
|
+
*/
|
|
21
|
+
export type ProviderCategory = "anthropic" | "openai" | "openai-compat" | "openai-responses" | "gemini" | "bedrock" | "custom";
|
|
22
|
+
/**
|
|
23
|
+
* Capabilities that a provider/model may support
|
|
24
|
+
*/
|
|
25
|
+
export type ProviderCapability = "reasoning" | "prompt-cache" | "streaming" | "tools" | "vision" | "computer-use" | "oauth";
|
|
26
|
+
/**
|
|
27
|
+
* Authentication configuration
|
|
28
|
+
*/
|
|
29
|
+
export interface AuthConfig {
|
|
30
|
+
/** API key (most common) */
|
|
31
|
+
apiKey?: string;
|
|
32
|
+
/** OAuth access token */
|
|
33
|
+
accessToken?: string;
|
|
34
|
+
/** Refresh token for OAuth */
|
|
35
|
+
refreshToken?: string;
|
|
36
|
+
/** Account ID (for account-based auth) */
|
|
37
|
+
accountId?: string;
|
|
38
|
+
/** OAuth callback path (e.g., for Qwen Code) */
|
|
39
|
+
oauthPath?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Endpoint configuration
|
|
43
|
+
*/
|
|
44
|
+
export interface EndpointConfig {
|
|
45
|
+
/** Base URL for the API */
|
|
46
|
+
baseUrl?: string;
|
|
47
|
+
/** Custom headers to include */
|
|
48
|
+
headers?: Record<string, string>;
|
|
49
|
+
/** Request timeout in milliseconds */
|
|
50
|
+
timeoutMs?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Custom `fetch` implementation used by the AI gateway providers when
|
|
53
|
+
* issuing requests. When supplied, it is forwarded to
|
|
54
|
+
* `GatewayProviderSettings.fetch` (and as a top-level fallback on
|
|
55
|
+
* `GatewayConfig.fetch`) so hosts can inject custom HTTP behavior such
|
|
56
|
+
* as proxies, retries, tracing, or test doubles.
|
|
57
|
+
*/
|
|
58
|
+
fetch?: typeof fetch;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Model configuration
|
|
62
|
+
*/
|
|
63
|
+
export interface ModelConfig {
|
|
64
|
+
/** Model identifier */
|
|
65
|
+
modelId: string;
|
|
66
|
+
/** Pre-fetched model info (optional - will use defaults if not provided) */
|
|
67
|
+
modelInfo?: ModelInfo;
|
|
68
|
+
/** Known models for this provider with their info */
|
|
69
|
+
knownModels?: Record<string, ModelInfo>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Token limits configuration
|
|
73
|
+
*/
|
|
74
|
+
export interface TokenConfig {
|
|
75
|
+
/** Maximum input tokens (overrides model default) */
|
|
76
|
+
maxInputTokens?: number;
|
|
77
|
+
/** Maximum output tokens (overrides model default) */
|
|
78
|
+
maxOutputTokens?: number;
|
|
79
|
+
/**
|
|
80
|
+
* The per-turn cap to synthesize when no explicit one is requested.
|
|
81
|
+
*
|
|
82
|
+
* Distinct from {@link maxOutputTokens}, which is the user's own ceiling and
|
|
83
|
+
* goes on the wire as the request's cap. This is what the session resolved
|
|
84
|
+
* for itself -- a share of the window, or the Output Budget setting -- and
|
|
85
|
+
* is the figure its system prompt quotes. Carried separately so the number
|
|
86
|
+
* in the prompt and the number on the wire are the same one.
|
|
87
|
+
*/
|
|
88
|
+
defaultMaxOutputTokens?: number;
|
|
89
|
+
/** Sampling temperature (overrides model default) */
|
|
90
|
+
temperature?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Marks a config the machinery uses for its own calls -- summarising,
|
|
93
|
+
* condensing, titling -- rather than for the conversation.
|
|
94
|
+
*
|
|
95
|
+
* Carried through to `GatewayStreamRequest.auxiliary`, where it keeps the
|
|
96
|
+
* call from writing itself into the process-wide record of "the last
|
|
97
|
+
* request" that the next compaction pass reads.
|
|
98
|
+
*/
|
|
99
|
+
auxiliary?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Reasoning/thinking model configuration
|
|
103
|
+
*/
|
|
104
|
+
export interface ReasoningConfig {
|
|
105
|
+
/** Reasoning effort level */
|
|
106
|
+
reasoningEffort?: ReasoningEffort;
|
|
107
|
+
/** Extended thinking budget in tokens */
|
|
108
|
+
thinkingBudgetTokens?: number;
|
|
109
|
+
/** Enable thinking with provider/model defaults when supported */
|
|
110
|
+
thinking?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* How much prior assistant reasoning to send back, or `auto` to decide it
|
|
113
|
+
* per model from a measured capability. Unset means `auto`.
|
|
114
|
+
*/
|
|
115
|
+
reasoningHistory?: ReasoningHistorySetting;
|
|
116
|
+
/**
|
|
117
|
+
* Whether `auto` may inline prior reasoning into content when the endpoint's
|
|
118
|
+
* template renders none of the reasoning field. Unset means on.
|
|
119
|
+
*/
|
|
120
|
+
reasoningInline?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Region configuration (shared across cloud providers)
|
|
124
|
+
*/
|
|
125
|
+
export interface RegionConfig {
|
|
126
|
+
/** Cloud region (AWS, GCP, Azure, or provider-specific like Qwen's china/international) */
|
|
127
|
+
region?: string;
|
|
128
|
+
/** API line for region-specific routing (e.g., "china" | "international" for Qwen) */
|
|
129
|
+
apiLine?: "china" | "international";
|
|
130
|
+
/** Use cross-region inference (Bedrock) */
|
|
131
|
+
useCrossRegionInference?: boolean;
|
|
132
|
+
/** Use global inference (Bedrock) */
|
|
133
|
+
useGlobalInference?: boolean;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* AWS-specific configuration (for Bedrock)
|
|
137
|
+
*/
|
|
138
|
+
export interface AwsConfig {
|
|
139
|
+
accessKey?: string;
|
|
140
|
+
secretKey?: string;
|
|
141
|
+
sessionToken?: string;
|
|
142
|
+
authentication?: "iam" | "api-key" | "apikey" | "profile";
|
|
143
|
+
profile?: string;
|
|
144
|
+
usePromptCache?: boolean;
|
|
145
|
+
endpoint?: string;
|
|
146
|
+
customModelBaseId?: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Google Cloud configuration (for Vertex AI)
|
|
150
|
+
*/
|
|
151
|
+
export interface GcpConfig {
|
|
152
|
+
projectId?: string;
|
|
153
|
+
region?: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Azure configuration (for Azure OpenAI)
|
|
157
|
+
*/
|
|
158
|
+
export interface AzureConfig {
|
|
159
|
+
apiVersion?: string;
|
|
160
|
+
useIdentity?: boolean;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* SAP AI Core configuration
|
|
164
|
+
*/
|
|
165
|
+
export interface SapConfig {
|
|
166
|
+
clientId?: string;
|
|
167
|
+
clientSecret?: string;
|
|
168
|
+
tokenUrl?: string;
|
|
169
|
+
resourceGroup?: string;
|
|
170
|
+
deploymentId?: string;
|
|
171
|
+
useOrchestrationMode?: boolean;
|
|
172
|
+
api?: "orchestration" | "foundation-models";
|
|
173
|
+
defaultSettings?: Record<string, unknown>;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* OCA (Oracle Cloud AI) configuration
|
|
177
|
+
*/
|
|
178
|
+
export interface OcaConfig {
|
|
179
|
+
mode?: "internal" | "external";
|
|
180
|
+
usePromptCache?: boolean;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Codex CLI provider options
|
|
184
|
+
*/
|
|
185
|
+
export interface CodexConfig {
|
|
186
|
+
defaultSettings?: Record<string, unknown>;
|
|
187
|
+
modelSettings?: Record<string, unknown>;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Claude Code provider options
|
|
191
|
+
*/
|
|
192
|
+
export interface ClaudeCodeConfig {
|
|
193
|
+
[key: string]: unknown;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* OpenCode provider options
|
|
197
|
+
*/
|
|
198
|
+
export interface OpenCodeConfig {
|
|
199
|
+
hostname?: string;
|
|
200
|
+
port?: number;
|
|
201
|
+
autoStartServer?: boolean;
|
|
202
|
+
serverTimeout?: number;
|
|
203
|
+
defaultSettings?: Record<string, unknown>;
|
|
204
|
+
modelSettings?: Record<string, unknown>;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Cloud provider configurations (grouped)
|
|
208
|
+
*/
|
|
209
|
+
export interface CloudConfig {
|
|
210
|
+
/** AWS/Bedrock options */
|
|
211
|
+
aws?: AwsConfig;
|
|
212
|
+
/** Google Cloud/Vertex options */
|
|
213
|
+
gcp?: GcpConfig;
|
|
214
|
+
/** Azure options */
|
|
215
|
+
azure?: AzureConfig;
|
|
216
|
+
/** SAP AI Core options */
|
|
217
|
+
sap?: SapConfig;
|
|
218
|
+
/** OCA options */
|
|
219
|
+
oca?: OcaConfig;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Sampling parameters passed through to a provider that exposes them.
|
|
223
|
+
*
|
|
224
|
+
* Every field is optional and nothing is defaulted: an unset field is one the
|
|
225
|
+
* request does not mention, which leaves whatever the model was built with in
|
|
226
|
+
* force. That matters for local models, where the Modelfile is where a
|
|
227
|
+
* validated sampler lives and a client that always sends a full set would
|
|
228
|
+
* silently overwrite it.
|
|
229
|
+
*
|
|
230
|
+
* The names are Ollama's own (`/api/chat` `options`), because this exists to
|
|
231
|
+
* carry them and inventing neutral synonyms would only make the mapping
|
|
232
|
+
* lossy. Providers that do not understand a field ignore the whole bag.
|
|
233
|
+
*/
|
|
234
|
+
export interface ProviderSamplingOptions {
|
|
235
|
+
temperature?: number;
|
|
236
|
+
topK?: number;
|
|
237
|
+
topP?: number;
|
|
238
|
+
minP?: number;
|
|
239
|
+
typicalP?: number;
|
|
240
|
+
repeatLastN?: number;
|
|
241
|
+
repeatPenalty?: number;
|
|
242
|
+
presencePenalty?: number;
|
|
243
|
+
frequencyPenalty?: number;
|
|
244
|
+
seed?: number;
|
|
245
|
+
numPredict?: number;
|
|
246
|
+
numKeep?: number;
|
|
247
|
+
/**
|
|
248
|
+
* How many model layers to put on the GPU. Ollama's `num_gpu`.
|
|
249
|
+
*
|
|
250
|
+
* Its own estimator decides this by default and is conservative: it has been
|
|
251
|
+
* measured refusing layers that fit, dropping a model to CPU without saying
|
|
252
|
+
* so. -1 leaves the decision to it; a number large enough to cover the model
|
|
253
|
+
* (99 is the usual idiom) means "all of them".
|
|
254
|
+
*/
|
|
255
|
+
numGpu?: number;
|
|
256
|
+
stop?: string[];
|
|
257
|
+
/**
|
|
258
|
+
* Bound on how many tokens the model may spend inside a thinking block,
|
|
259
|
+
* as a token count or an effort level. Ollama's `think_budget`.
|
|
260
|
+
*/
|
|
261
|
+
thinkBudget?: string;
|
|
262
|
+
/**
|
|
263
|
+
* Text written into the thinking block just before the closing tag is
|
|
264
|
+
* forced, so the model reads that it has to answer now. Ollama's
|
|
265
|
+
* `think_budget_message`.
|
|
266
|
+
*/
|
|
267
|
+
thinkBudgetMessage?: string;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Provider-specific options that don't fit other categories
|
|
271
|
+
*/
|
|
272
|
+
export interface ProviderOptions {
|
|
273
|
+
/** OpenRouter provider sorting preference */
|
|
274
|
+
openRouterProviderSorting?: string;
|
|
275
|
+
/** Runtime model catalog refresh configuration */
|
|
276
|
+
modelCatalog?: ModelCatalogConfig;
|
|
277
|
+
/** Sampling parameters for providers that accept them per request. */
|
|
278
|
+
sampling?: ProviderSamplingOptions;
|
|
279
|
+
/** opencoti's PolyKV control plane. Inert for every other provider. */
|
|
280
|
+
polykv?: PolykvOptions;
|
|
281
|
+
/**
|
|
282
|
+
* The engine session requests built from this config run in (opencoti).
|
|
283
|
+
*
|
|
284
|
+
* On the config rather than only on an agent because some requests are
|
|
285
|
+
* built from a config alone -- the compaction summarizer is one. Without it
|
|
286
|
+
* each summary call arrived with no session, which the engine admits as a
|
|
287
|
+
* per-request allocation of the model's whole window: two or three extra
|
|
288
|
+
* sessions for every compaction, on the server the agents were queued on.
|
|
289
|
+
*/
|
|
290
|
+
engineSessionId?: string;
|
|
291
|
+
/** Attach those requests to a PolyKV pool tree; see `polykv-swarm.ts`. */
|
|
292
|
+
polykvWorker?: {
|
|
293
|
+
group: string;
|
|
294
|
+
layers: number;
|
|
295
|
+
/** Attach to the agent's existing tree without building anything. */
|
|
296
|
+
attachOnly?: boolean;
|
|
297
|
+
/**
|
|
298
|
+
* Build the tree in this session's window -- the lead's own -- instead
|
|
299
|
+
* of an owner opened for the swarm: priority 0, PLANS §9g.
|
|
300
|
+
*/
|
|
301
|
+
owner?: string;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* One exact-size booking for the requests built from this config
|
|
305
|
+
* (opencoti), instead of whatever the session's window rules would ask.
|
|
306
|
+
*
|
|
307
|
+
* Set by compaction for the calls it makes outside the conversation's own
|
|
308
|
+
* booking -- a critic on a pool nobody owns, the synthesizer, the
|
|
309
|
+
* retrospective -- so each books the cells it can use and no more. Without
|
|
310
|
+
* it such a call is a per-request admission, which on this engine asks for
|
|
311
|
+
* `session_ctx_max`: a quarter of 8244 for a two-thousand-token answer.
|
|
312
|
+
*
|
|
313
|
+
* Transient: the grant it gets back is not recorded as the session's
|
|
314
|
+
* window, so the resume rule and the compaction trigger never size a
|
|
315
|
+
* conversation against a number that described one summary call.
|
|
316
|
+
*/
|
|
317
|
+
polykvBooking?: {
|
|
318
|
+
numCtx: number;
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* `false`: never attach these requests to the lead tree, even when their
|
|
322
|
+
* system turn carries environment spans. A compaction critic continues the
|
|
323
|
+
* lead's prompt under a session of its own; the lead tree would hand it
|
|
324
|
+
* the lead's sub-pool, which is not the pool it was asked to attach to.
|
|
325
|
+
*/
|
|
326
|
+
polykvLeadPool?: boolean;
|
|
327
|
+
/** Which tools this configuration withholds from its sessions. */
|
|
328
|
+
tools?: ToolSelectionOptions;
|
|
329
|
+
/**
|
|
330
|
+
* "Agent window" (opencoti): the floor a delegated agent's session accepts,
|
|
331
|
+
* as a share between the minimum one turn needs (0) and the node's window
|
|
332
|
+
* (100). Set by the host on an agent node's connection; inert elsewhere.
|
|
333
|
+
* See `opencoti-agent-window.ts`.
|
|
334
|
+
*/
|
|
335
|
+
agentWindow?: {
|
|
336
|
+
sharePercent?: number;
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* The tools a configuration leaves out.
|
|
341
|
+
*
|
|
342
|
+
* A deny list, because the tool set grows: an allow list written today would
|
|
343
|
+
* withhold every tool added after it from every configuration that already
|
|
344
|
+
* exists, and the symptom would be a model that never calls a tool nobody
|
|
345
|
+
* remembers switching off.
|
|
346
|
+
*
|
|
347
|
+
* Names are the registered tool names, so an MCP tool appears under the name
|
|
348
|
+
* it was registered with rather than under `server__tool` -- the two differ
|
|
349
|
+
* whenever the transform had to rewrite or truncate the pair.
|
|
350
|
+
*
|
|
351
|
+
* Why a configuration and not a global setting: the reason to drop a tool is
|
|
352
|
+
* the window it has to fit in. The tool schemas are a fixed price paid before
|
|
353
|
+
* a single message exists -- measured at 21,000-24,000 tokens of a
|
|
354
|
+
* 65,536-token window -- so a profile pointed at a small local model and one
|
|
355
|
+
* pointed at a 400k cloud model want opposite answers, and only the profile
|
|
356
|
+
* knows which is which.
|
|
357
|
+
*/
|
|
358
|
+
export interface ToolSelectionOptions {
|
|
359
|
+
disabled?: string[];
|
|
360
|
+
/** Whether an oversized file-read window is refused. Absent means on. */
|
|
361
|
+
readLimitEnabled?: boolean;
|
|
362
|
+
/** The refusal threshold in characters. Absent means the built-in default. */
|
|
363
|
+
readLimitChars?: number;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* How this session uses opencoti's KV pool tree, and what it asks the engine to
|
|
367
|
+
* enforce on its behalf.
|
|
368
|
+
*
|
|
369
|
+
* Shaped to match `PolykvSettingsSchema` in `@cerebriline/core` field for field, so a
|
|
370
|
+
* value typed into the settings panel reaches the vendor without a translation
|
|
371
|
+
* step that could drop one.
|
|
372
|
+
*/
|
|
373
|
+
export interface PolykvOptions {
|
|
374
|
+
enabled?: boolean;
|
|
375
|
+
pinPrefix?: boolean;
|
|
376
|
+
ephemeral?: boolean;
|
|
377
|
+
compactionPressureThreshold?: number;
|
|
378
|
+
targetTpsPerSession?: number;
|
|
379
|
+
mode?: "advisory" | "enforced";
|
|
380
|
+
onSaturation?: "reject" | "warn";
|
|
381
|
+
guaranteeMinSessions?: number;
|
|
382
|
+
settleTokens?: number;
|
|
383
|
+
settleMaxMs?: number;
|
|
384
|
+
prefillMaxSlots?: number;
|
|
385
|
+
overcommit?: boolean;
|
|
386
|
+
/**
|
|
387
|
+
* Whether the model may fan a task out across a swarm of workers sharing
|
|
388
|
+
* this session's prefix.
|
|
389
|
+
*
|
|
390
|
+
* Off by default, and deliberately: a swarm spends several agents' worth of
|
|
391
|
+
* tokens on one turn, and that is a decision worth making once rather than
|
|
392
|
+
* discovering in a bill.
|
|
393
|
+
*/
|
|
394
|
+
swarm?: boolean;
|
|
395
|
+
maxRetryAfterMs?: number;
|
|
396
|
+
/**
|
|
397
|
+
* Book a guaranteed context window, and accept a smaller one down to
|
|
398
|
+
* `contextFloor`.
|
|
399
|
+
*
|
|
400
|
+
* **Off by default, and the default is the conservative one.** Asking for a
|
|
401
|
+
* window changes what a busy server does with the request: from serving it
|
|
402
|
+
* best-effort to refusing it at admission. That is a decision to make, not
|
|
403
|
+
* one to take on someone's behalf -- so with this off nothing is booked and
|
|
404
|
+
* the engine decides, exactly as before.
|
|
405
|
+
*
|
|
406
|
+
* On, the window asked for is the model's configured context size and the
|
|
407
|
+
* server grants the largest that fits in `[contextFloor, window]`.
|
|
408
|
+
*/
|
|
409
|
+
dynamicContextSize?: boolean;
|
|
410
|
+
/**
|
|
411
|
+
* The smallest window still worth connecting with.
|
|
412
|
+
*
|
|
413
|
+
* Below it, a connection is worse than none: the conversation would open
|
|
414
|
+
* and immediately be unable to hold enough to be useful. With no floor set
|
|
415
|
+
* the ask is all-or-nothing, which is the honest reading of "I did not say
|
|
416
|
+
* what smaller would be acceptable".
|
|
417
|
+
*/
|
|
418
|
+
contextFloor?: number;
|
|
419
|
+
/**
|
|
420
|
+
* Compaction runs as a continuation of the session: the summary is written
|
|
421
|
+
* in the session's own context, the reviewers continue from it, and the
|
|
422
|
+
* session's cells are given back before the replay is joined.
|
|
423
|
+
*
|
|
424
|
+
* **On by default** wherever the engine advertises what it needs; `false`
|
|
425
|
+
* turns it off and compaction re-sends the transcript as text, as before.
|
|
426
|
+
*/
|
|
427
|
+
continuationCompaction?: boolean;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Runtime model catalog refresh options
|
|
431
|
+
*/
|
|
432
|
+
export interface ModelCatalogConfig {
|
|
433
|
+
/** Fetch latest catalog at handler initialization */
|
|
434
|
+
loadLatestOnInit?: boolean;
|
|
435
|
+
/** Fetch provider-private models when auth is available */
|
|
436
|
+
loadPrivateOnAuth?: boolean;
|
|
437
|
+
/** Catalog endpoint URL */
|
|
438
|
+
url?: string;
|
|
439
|
+
/** Cache TTL for live catalog in milliseconds */
|
|
440
|
+
cacheTtlMs?: number;
|
|
441
|
+
/** Throw when live catalog refresh fails */
|
|
442
|
+
failOnError?: boolean;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Unified provider configuration interface
|
|
446
|
+
*
|
|
447
|
+
* This is the single configuration interface that clients provide.
|
|
448
|
+
* All provider-specific options are grouped into logical sub-interfaces.
|
|
449
|
+
*/
|
|
450
|
+
export interface ProviderConfig extends AuthConfig, EndpointConfig, ModelConfig, TokenConfig, ReasoningConfig, RegionConfig, CloudConfig, ProviderOptions {
|
|
451
|
+
/** Client type - determines which handler to use - OpenAI-Compatible deafult */
|
|
452
|
+
clientType?: ProviderClient;
|
|
453
|
+
/** Provider ID */
|
|
454
|
+
providerId: ProviderId;
|
|
455
|
+
/**
|
|
456
|
+
* Optional built-in provider family to use for handler routing.
|
|
457
|
+
*
|
|
458
|
+
* This lets clients expose a custom provider ID and model catalog while
|
|
459
|
+
* reusing the runtime behavior of a built-in provider implementation.
|
|
460
|
+
*/
|
|
461
|
+
routingProviderId?: ProviderId;
|
|
462
|
+
/** Capabilities this provider/model supports */
|
|
463
|
+
capabilities?: ProviderCapability[];
|
|
464
|
+
/** Task/session ID for telemetry */
|
|
465
|
+
taskId?: string;
|
|
466
|
+
/** AbortSignal for cancelling requests */
|
|
467
|
+
abortSignal?: AbortSignal;
|
|
468
|
+
/** Optional runtime logger for provider-level diagnostics */
|
|
469
|
+
logger?: BasicLogger;
|
|
470
|
+
/**
|
|
471
|
+
* Ambient runtime context: user identity, client surface, workspace info,
|
|
472
|
+
* logger, and telemetry service. Prefer reading logger and telemetry from
|
|
473
|
+
* here when available; the top-level logger field is kept for compatibility.
|
|
474
|
+
*/
|
|
475
|
+
extensionContext?: ExtensionContext;
|
|
476
|
+
/** Codex CLI-specific options */
|
|
477
|
+
codex?: CodexConfig;
|
|
478
|
+
/** Claude Code-specific options */
|
|
479
|
+
claudeCode?: ClaudeCodeConfig;
|
|
480
|
+
/** OpenCode-specific options */
|
|
481
|
+
opencode?: OpenCodeConfig;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Simplified configuration for common use cases
|
|
485
|
+
*/
|
|
486
|
+
export interface SimpleProviderConfig {
|
|
487
|
+
providerId: ProviderId;
|
|
488
|
+
clientType: ProviderClient;
|
|
489
|
+
apiKey: string;
|
|
490
|
+
modelId: string;
|
|
491
|
+
baseUrl?: string;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Create a full ProviderConfig from a simple config
|
|
495
|
+
*/
|
|
496
|
+
export declare function createConfig(simple: SimpleProviderConfig): ProviderConfig;
|
|
497
|
+
/**
|
|
498
|
+
* Check if a provider config has a specific capability
|
|
499
|
+
*/
|
|
500
|
+
export declare function hasCapability(config: ProviderConfig, capability: ProviderCapability): boolean;
|
|
501
|
+
/**
|
|
502
|
+
* Check if provider supports reasoning/thinking
|
|
503
|
+
*/
|
|
504
|
+
export declare function supportsReasoning(config: ProviderConfig): boolean;
|
|
505
|
+
/**
|
|
506
|
+
* Check if provider supports prompt caching
|
|
507
|
+
*/
|
|
508
|
+
export declare function supportsPromptCache(config: ProviderConfig): boolean;
|
|
509
|
+
/**
|
|
510
|
+
* Resolve the provider ID used for handler selection and built-in behavior.
|
|
511
|
+
*/
|
|
512
|
+
export declare function resolveRoutingProviderId(config: Pick<ProviderConfig, "providerId" | "routingProviderId">): string;
|
|
513
|
+
/**
|
|
514
|
+
* @deprecated Use ProviderConfig directly - all fields are now unified
|
|
515
|
+
*/
|
|
516
|
+
export type ProviderSpecificConfig = Pick<ProviderConfig, "aws" | "gcp" | "azure" | "sap" | "oca" | "maxInputTokens" | "apiLine" | "oauthPath" | "openRouterProviderSorting">;
|
|
517
|
+
/**
|
|
518
|
+
* @deprecated Use ProviderConfig directly
|
|
519
|
+
*/
|
|
520
|
+
export type ProviderDefaultsConfig = Pick<ProviderConfig, "baseUrl" | "modelId" | "knownModels" | "headers" | "capabilities">;
|
|
521
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/providers/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACX,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EACN,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,MAAM,OAAO,CAAC;AAGf,OAAO,EACN,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,mBAAmB,GACnB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACzB,WAAW,GACX,QAAQ,GACR,eAAe,GACf,kBAAkB,GAClB,QAAQ,GACR,SA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CAAC;IACvB,UAAU,EAAE,cAAc,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAQzE;AAMD;;GAEG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEnE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,mBAAmB,CAAC,GAC9D,MAAM,CAER;AAMD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACxC,cAAc,EACZ,KAAK,GACL,KAAK,GACL,OAAO,GACP,KAAK,GACL,KAAK,GACL,gBAAgB,GAChB,SAAS,GACT,WAAW,GACX,2BAA2B,CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACxC,cAAc,EACd,SAAS,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,cAAc,CAClE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ProviderErrorClass, type ToolCallRejection } from "@cerebriline/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Classify a raw provider error (or an already-flattened error message) into
|
|
4
|
+
* a {@link ProviderErrorClass}. Call this where the structured error object
|
|
5
|
+
* is still available — `extractErrorMessage` discards the structure this
|
|
6
|
+
* classification relies on.
|
|
7
|
+
*
|
|
8
|
+
* Typed AI SDK error instances are classified first via their typed fields;
|
|
9
|
+
* everything else — including plain JSON payloads that only *look* like AI
|
|
10
|
+
* SDK errors — goes through the conservative structural walk.
|
|
11
|
+
*/
|
|
12
|
+
export declare function classifyProviderError(error: unknown): ProviderErrorClass;
|
|
13
|
+
/**
|
|
14
|
+
* The engine's account of a tool call it rejected, if the error carries one.
|
|
15
|
+
*
|
|
16
|
+
* Looks for opencoti's `{type: "tool_call_rejected", reason, key?, tool?}`
|
|
17
|
+
* anywhere in the error: on the object itself, under `error`, in an HTTP
|
|
18
|
+
* response body, or JSON-encoded in a message string (a streamed SSE `error`
|
|
19
|
+
* event arrives that way). `undefined` when there is none. The rejection is
|
|
20
|
+
* still classified from its message; only the specific wording is lost.
|
|
21
|
+
*/
|
|
22
|
+
export declare function extractToolCallRejection(error: unknown): ToolCallRejection | undefined;
|
|
23
|
+
//# sourceMappingURL=error-classification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-classification.d.ts","sourceRoot":"","sources":["../../src/providers/error-classification.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EACtB,MAAM,eAAe,CAAC;AAmcvB;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAqBxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACvC,KAAK,EAAE,OAAO,GACZ,iBAAiB,GAAG,SAAS,CAE/B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const CLINE_NOT_SUBSCRIBED_RESPONSE_MESSAGE = "the user is not subscribed to required model plan";
|
|
2
|
+
export declare const CLINE_ORG_INDIVIDUAL_INFERENCE_SUBSCRIPTION_RESPONSE_MESSAGE = "organization accounts cannot use individual model inference subscriptions";
|
|
3
|
+
export declare function getClinePassSubscriptionUrl(): string;
|
|
4
|
+
export declare function getClineNotSubscribedMessage(): string;
|
|
5
|
+
export declare class ClineNotSubscribedError extends Error {
|
|
6
|
+
readonly providerId?: string;
|
|
7
|
+
constructor(providerId?: string);
|
|
8
|
+
}
|
|
9
|
+
export declare function getClineOrgIndividualInferenceSubscriptionMessage(): string;
|
|
10
|
+
export declare class ClineOrgIndividualInferenceSubscriptionError extends Error {
|
|
11
|
+
readonly providerId?: string;
|
|
12
|
+
constructor(providerId?: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class ClinePassLimitError extends Error {
|
|
15
|
+
readonly providerId?: string;
|
|
16
|
+
constructor(message: string, providerId?: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class ClineFreeModelLimitError extends Error {
|
|
19
|
+
readonly providerId?: string;
|
|
20
|
+
constructor(message: string, providerId?: string);
|
|
21
|
+
}
|
|
22
|
+
export declare function isClineNotSubscribedError(error: unknown): error is ClineNotSubscribedError;
|
|
23
|
+
export declare function isClineOrgIndividualInferenceSubscriptionError(error: unknown): error is ClineOrgIndividualInferenceSubscriptionError;
|
|
24
|
+
export declare function isClinePassLimitError(error: unknown): error is ClinePassLimitError;
|
|
25
|
+
export declare function isClineFreeModelLimitError(error: unknown): error is ClineFreeModelLimitError;
|
|
26
|
+
export declare function isClineNotSubscribedMessage(text: string): boolean;
|
|
27
|
+
export declare function isClineOrgIndividualInferenceSubscriptionMessage(text: string): boolean;
|
|
28
|
+
export declare function isClinePassLimitMessage(text: string): boolean;
|
|
29
|
+
export declare function extractClinePassLimitMessage(text: string): string | undefined;
|
|
30
|
+
export declare function isClineFreeModelLimitMessage(text: string): boolean;
|
|
31
|
+
export declare function isClineModelNotFoundMessage(text: string): boolean;
|
|
32
|
+
export declare function extractClineFreeModelLimitResetTime(text: string): string | undefined;
|
|
33
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/providers/errors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qCAAqC,sDACE,CAAC;AAGrD,eAAO,MAAM,4DAA4D,8EACG,CAAC;AA+B7E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