@clinebot/shared 0.0.13 → 0.0.15
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/dist/db/index.js +2 -2
- package/dist/remote-config/constants.d.ts +5 -0
- package/dist/remote-config/schema.d.ts +426 -0
- package/package.json +10 -3
- package/src/db/sqlite-db.ts +11 -4
- package/src/index.browser.ts +2 -0
- package/src/index.ts +2 -0
- package/src/remote-config/constants.ts +5 -0
- package/src/remote-config/schema.test.ts +1004 -0
- package/src/remote-config/schema.ts +263 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ═══════════════════════════════════════════════════════════════════════════
|
|
3
|
+
* ⚠️ CRITICAL WARNING ⚠️
|
|
4
|
+
* ═══════════════════════════════════════════════════════════════════════════
|
|
5
|
+
*
|
|
6
|
+
* THE API SERVER MUST BE RE-DEPLOYED WHENEVER THIS SCHEMA IS UPDATED!
|
|
7
|
+
*
|
|
8
|
+
* This schema is used by both the extension and the API server for validation.
|
|
9
|
+
* Any changes here require a coordinated deployment to avoid validation errors.
|
|
10
|
+
*
|
|
11
|
+
* ═══════════════════════════════════════════════════════════════════════════
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
|
|
16
|
+
// OpenAI Compatible model schema with per-model settings
|
|
17
|
+
export const OpenAiCompatibleModelSchema = z.object({
|
|
18
|
+
id: z.string(), // The model ID is required
|
|
19
|
+
temperature: z.number().optional(),
|
|
20
|
+
isR1FormatRequired: z.boolean().optional(),
|
|
21
|
+
maxTokens: z.number().optional(),
|
|
22
|
+
contextWindow: z.number().optional(),
|
|
23
|
+
inputPrice: z.number().optional(),
|
|
24
|
+
outputPrice: z.number().optional(),
|
|
25
|
+
supportsImages: z.boolean().optional(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// OpenAiCompatible specific settings
|
|
29
|
+
export const OpenAiCompatibleSchema = z.object({
|
|
30
|
+
// A list of the allowed models with their settings
|
|
31
|
+
models: z.array(OpenAiCompatibleModelSchema).optional(),
|
|
32
|
+
// OpenAiCompatible specific settings:
|
|
33
|
+
openAiBaseUrl: z.string().optional(),
|
|
34
|
+
openAiHeaders: z.record(z.string(), z.string()).optional(),
|
|
35
|
+
azureApiVersion: z.string().optional(),
|
|
36
|
+
azureIdentity: z.boolean().optional(),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// AWS Bedrock model schema with per-model settings
|
|
40
|
+
export const AwsBedrockModelSchema = z.object({
|
|
41
|
+
id: z.string(), // The model ID is required
|
|
42
|
+
thinkingBudgetTokens: z.number().optional(),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// AWS Bedrock custom model schema (separate from regular models)
|
|
46
|
+
export const AwsBedrockCustomModelSchema = z.object({
|
|
47
|
+
name: z.string(), // The model name is required
|
|
48
|
+
baseModelId: z.string(), // The base model ID is required
|
|
49
|
+
thinkingBudgetTokens: z.number().optional(),
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// AWS Bedrock specific settings
|
|
53
|
+
export const AwsBedrockSettingsSchema = z.object({
|
|
54
|
+
// A list of the allowed models with their settings
|
|
55
|
+
models: z.array(AwsBedrockModelSchema).optional(),
|
|
56
|
+
// Custom models
|
|
57
|
+
customModels: z.array(AwsBedrockCustomModelSchema).optional(),
|
|
58
|
+
// AWS Bedrock specific settings:
|
|
59
|
+
awsRegion: z.string().optional(),
|
|
60
|
+
awsUseCrossRegionInference: z.boolean().optional(),
|
|
61
|
+
awsUseGlobalInference: z.boolean().optional(),
|
|
62
|
+
awsBedrockUsePromptCache: z.boolean().optional(),
|
|
63
|
+
awsBedrockEndpoint: z.string().optional(),
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Cline Provider model schema with per-model settings
|
|
67
|
+
export const ClineModelSchema = z.object({
|
|
68
|
+
id: z.string(), // The model ID is required
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Cline Provider specific settings
|
|
72
|
+
export const ClineSettingsSchema = z.object({
|
|
73
|
+
// A list of the allowed models with their settings
|
|
74
|
+
models: z.array(ClineModelSchema).optional(),
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Vertex Provider model schema with per-model settings
|
|
78
|
+
export const VertexModelSchema = z.object({
|
|
79
|
+
id: z.string(), // The model ID is required
|
|
80
|
+
thinkingBudgetTokens: z.number().optional(),
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// GCP Vertex Provider specific settings
|
|
84
|
+
export const VertexSettingsSchema = z.object({
|
|
85
|
+
// A list of the allowed models with their settings
|
|
86
|
+
models: z.array(VertexModelSchema).optional(),
|
|
87
|
+
vertexProjectId: z.string().optional(),
|
|
88
|
+
vertexRegion: z.string().optional(),
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export const LiteLLMModelSchema = z.object({
|
|
92
|
+
id: z.string(),
|
|
93
|
+
thinkingBudgetTokens: z.number().optional(),
|
|
94
|
+
promptCachingEnabled: z.boolean().optional(),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export const LiteLLMSchema = z.object({
|
|
98
|
+
models: z.array(LiteLLMModelSchema).optional(),
|
|
99
|
+
baseUrl: z.string().optional(),
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
export const AnthropicModelSchema = z.object({
|
|
103
|
+
id: z.string(),
|
|
104
|
+
thinkingBudgetTokens: z.number().optional(),
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export const AnthropicSchema = z.object({
|
|
108
|
+
models: z.array(AnthropicModelSchema).optional(),
|
|
109
|
+
baseUrl: z.string().optional(),
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Provider settings schema
|
|
113
|
+
// Each provider becomes an optional field
|
|
114
|
+
const ProviderSettingsSchema = z.object({
|
|
115
|
+
OpenAiCompatible: OpenAiCompatibleSchema.optional(),
|
|
116
|
+
AwsBedrock: AwsBedrockSettingsSchema.optional(),
|
|
117
|
+
Cline: ClineSettingsSchema.optional(),
|
|
118
|
+
Vertex: VertexSettingsSchema.optional(),
|
|
119
|
+
LiteLLM: LiteLLMSchema.optional(),
|
|
120
|
+
Anthropic: AnthropicSchema.optional(),
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
export const AllowedMCPServerSchema = z.object({
|
|
124
|
+
// The ID of the MCP is the URL for their github repo.
|
|
125
|
+
id: z.string(),
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export const RemoteMCPServerSchema = z.object({
|
|
129
|
+
// The name of the MCP server
|
|
130
|
+
name: z.string(),
|
|
131
|
+
// The URL of the MCP server
|
|
132
|
+
url: z.string(),
|
|
133
|
+
// When this is true, the user cannot disable this MCP server
|
|
134
|
+
alwaysEnabled: z.boolean().optional(),
|
|
135
|
+
// Headers to allow for custom auth
|
|
136
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// Settings for a global cline rules or workflow file.
|
|
140
|
+
export const GlobalInstructionsFileSchema = z.object({
|
|
141
|
+
// When this is enabled, the user cannot turn off this rule or workflow.
|
|
142
|
+
alwaysEnabled: z.boolean(),
|
|
143
|
+
// The name of the rules or workflow file.
|
|
144
|
+
name: z.string(),
|
|
145
|
+
// The contents of the rules or workflow file
|
|
146
|
+
contents: z.string(),
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export const S3AccessKeySettingsSchema = z.object({
|
|
150
|
+
bucket: z.string(),
|
|
151
|
+
accessKeyId: z.string(),
|
|
152
|
+
secretAccessKey: z.string(),
|
|
153
|
+
region: z.string().optional(),
|
|
154
|
+
endpoint: z.string().optional(),
|
|
155
|
+
accountId: z.string().optional(),
|
|
156
|
+
intervalMs: z.number().optional(),
|
|
157
|
+
maxRetries: z.number().optional(),
|
|
158
|
+
batchSize: z.number().optional(),
|
|
159
|
+
maxQueueSize: z.number().optional(),
|
|
160
|
+
maxFailedAgeMs: z.number().optional(),
|
|
161
|
+
backfillEnabled: z.boolean().optional(),
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
export const PromptUploadingSchema = z.object({
|
|
165
|
+
enabled: z.boolean().optional(),
|
|
166
|
+
type: z
|
|
167
|
+
.union([z.literal("s3_access_keys"), z.literal("r2_access_keys")])
|
|
168
|
+
.optional(),
|
|
169
|
+
s3AccessSettings: S3AccessKeySettingsSchema.optional(),
|
|
170
|
+
r2AccessSettings: S3AccessKeySettingsSchema.optional(),
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
export const EnterpriseTelemetrySchema = z.object({
|
|
174
|
+
promptUploading: PromptUploadingSchema.optional(),
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
export const RemoteConfigSchema = z.object({
|
|
178
|
+
// The version of the remote config settings, e.g. v1
|
|
179
|
+
// This field is for internal use only, and won't be visible to the administrator in the UI.
|
|
180
|
+
version: z.string(),
|
|
181
|
+
|
|
182
|
+
// Provider specific settings
|
|
183
|
+
providerSettings: ProviderSettingsSchema.optional(),
|
|
184
|
+
|
|
185
|
+
// General settings not specific to any provider
|
|
186
|
+
telemetryEnabled: z.boolean().optional(),
|
|
187
|
+
kanbanEnabled: z.boolean().optional(),
|
|
188
|
+
|
|
189
|
+
// MCP settings
|
|
190
|
+
// If this is false, the MCP marketplace is disabled in the extension
|
|
191
|
+
mcpMarketplaceEnabled: z.boolean().optional(),
|
|
192
|
+
|
|
193
|
+
// If this is configured, the users only have access to these allowlisted MCP servers in the marketplace.
|
|
194
|
+
allowedMCPServers: z.array(AllowedMCPServerSchema).optional(),
|
|
195
|
+
|
|
196
|
+
// A list of pre-configured remote MCP servers.
|
|
197
|
+
remoteMCPServers: z.array(RemoteMCPServerSchema).optional(),
|
|
198
|
+
// If this is true, users cannot use or configure MCP servers that are not remotely configured.
|
|
199
|
+
blockPersonalRemoteMCPServers: z.boolean().optional(),
|
|
200
|
+
|
|
201
|
+
// If the user is allowed to enable YOLO mode. Note this is different from the extension setting
|
|
202
|
+
// yoloModeEnabled, because we do not want to force YOLO enabled for the user.
|
|
203
|
+
yoloModeAllowed: z.boolean().optional(),
|
|
204
|
+
|
|
205
|
+
// OpenTelemetry configuration
|
|
206
|
+
openTelemetryEnabled: z.boolean().optional(),
|
|
207
|
+
openTelemetryMetricsExporter: z.string().optional(),
|
|
208
|
+
openTelemetryLogsExporter: z.string().optional(),
|
|
209
|
+
openTelemetryOtlpProtocol: z.string().optional(),
|
|
210
|
+
openTelemetryOtlpEndpoint: z.string().optional(),
|
|
211
|
+
openTelemetryOtlpHeaders: z.record(z.string(), z.string()).optional(),
|
|
212
|
+
openTelemetryOtlpMetricsProtocol: z.string().optional(),
|
|
213
|
+
openTelemetryOtlpMetricsEndpoint: z.string().optional(),
|
|
214
|
+
openTelemetryOtlpMetricsHeaders: z.record(z.string(), z.string()).optional(),
|
|
215
|
+
openTelemetryOtlpLogsProtocol: z.string().optional(),
|
|
216
|
+
openTelemetryOtlpLogsEndpoint: z.string().optional(),
|
|
217
|
+
openTelemetryOtlpLogsHeaders: z.record(z.string(), z.string()).optional(),
|
|
218
|
+
openTelemetryMetricExportInterval: z.number().optional(),
|
|
219
|
+
openTelemetryOtlpInsecure: z.boolean().optional(),
|
|
220
|
+
openTelemetryLogBatchSize: z.number().optional(),
|
|
221
|
+
openTelemetryLogBatchTimeout: z.number().optional(),
|
|
222
|
+
openTelemetryLogMaxQueueSize: z.number().optional(),
|
|
223
|
+
|
|
224
|
+
enterpriseTelemetry: EnterpriseTelemetrySchema.optional(),
|
|
225
|
+
|
|
226
|
+
// Rules & Workflows
|
|
227
|
+
globalRules: z.array(GlobalInstructionsFileSchema).optional(),
|
|
228
|
+
globalWorkflows: z.array(GlobalInstructionsFileSchema).optional(),
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
export const APIKeySchema = z.record(z.string(), z.string());
|
|
232
|
+
|
|
233
|
+
// Type inference from schemas
|
|
234
|
+
export type RemoteConfig = z.infer<typeof RemoteConfigSchema>;
|
|
235
|
+
export type MCPServer = z.infer<typeof AllowedMCPServerSchema>;
|
|
236
|
+
export type RemoteMCPServer = z.infer<typeof RemoteMCPServerSchema>;
|
|
237
|
+
export type GlobalInstructionsFile = z.infer<
|
|
238
|
+
typeof GlobalInstructionsFileSchema
|
|
239
|
+
>;
|
|
240
|
+
|
|
241
|
+
export type ProviderSettings = z.infer<typeof ProviderSettingsSchema>;
|
|
242
|
+
|
|
243
|
+
export type OpenAiCompatible = z.infer<typeof OpenAiCompatibleSchema>;
|
|
244
|
+
export type OpenAiCompatibleModel = z.infer<typeof OpenAiCompatibleModelSchema>;
|
|
245
|
+
|
|
246
|
+
export type AwsBedrockSettings = z.infer<typeof AwsBedrockSettingsSchema>;
|
|
247
|
+
export type AwsBedrockModel = z.infer<typeof AwsBedrockModelSchema>;
|
|
248
|
+
export type AwsBedrockCustomModel = z.infer<typeof AwsBedrockCustomModelSchema>;
|
|
249
|
+
|
|
250
|
+
export type VertexSettings = z.infer<typeof VertexSettingsSchema>;
|
|
251
|
+
export type VertexModel = z.infer<typeof VertexModelSchema>;
|
|
252
|
+
|
|
253
|
+
export type LiteLLMSettings = z.infer<typeof LiteLLMSchema>;
|
|
254
|
+
export type LiteLLMModel = z.infer<typeof LiteLLMModelSchema>;
|
|
255
|
+
|
|
256
|
+
export type AnthropicSettings = z.infer<typeof AnthropicSchema>;
|
|
257
|
+
export type AnthropicModel = z.infer<typeof AnthropicModelSchema>;
|
|
258
|
+
|
|
259
|
+
export type APIKeySettings = z.infer<typeof APIKeySchema>;
|
|
260
|
+
|
|
261
|
+
export type EnterpriseTelemetry = z.infer<typeof EnterpriseTelemetrySchema>;
|
|
262
|
+
export type PromptUploading = z.infer<typeof PromptUploadingSchema>;
|
|
263
|
+
export type S3AccessKeySettings = z.infer<typeof S3AccessKeySettingsSchema>;
|