@saturn-universe/runtime-host 0.1.0 → 0.1.2-dev.2
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/builtin-plugins/saturn-plugin-ctf/index.mjs +2 -2
- package/dist/builtin-plugins/saturn-plugin-ctf/package.json +1 -1
- package/dist/composition.d.ts +2 -1
- package/dist/configuration.js +3 -3
- package/dist/cordis/model-responses-plugin.d.ts +2 -1
- package/dist/cordis/model-responses-plugin.js +16 -11
- package/dist/modes.js +6 -0
- package/dist/provider-catalog.d.ts +218 -22
- package/dist/provider-catalog.js +52 -34
- package/package.json +9 -9
|
@@ -171,10 +171,10 @@ function matchesScopeFilters(item, categorySet, idSet) {
|
|
|
171
171
|
|
|
172
172
|
export default {
|
|
173
173
|
id: 'ctf',
|
|
174
|
-
version: '0.1.
|
|
174
|
+
version: '0.1.2-dev.2',
|
|
175
175
|
kind: 'saturn-registrar',
|
|
176
176
|
apiVersion: 1,
|
|
177
|
-
sdkVersion: '0.1.
|
|
177
|
+
sdkVersion: '0.1.2-dev.2',
|
|
178
178
|
async setup(api, config = {}) {
|
|
179
179
|
const { boardToken, boardPublicHost, ...boardSettings } = settingsFor(config);
|
|
180
180
|
if (boardToken) api.registerSecret?.(boardToken);
|
package/dist/composition.d.ts
CHANGED
|
@@ -61,11 +61,12 @@ export declare function composeRuntime(store: SqliteStore, root: string, options
|
|
|
61
61
|
reasoningEfforts: string[];
|
|
62
62
|
modelId: string;
|
|
63
63
|
reasoningEffort?: string;
|
|
64
|
-
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini";
|
|
65
64
|
name: string;
|
|
66
65
|
providerId: string;
|
|
67
66
|
revision: string;
|
|
68
67
|
codecVersion: 1 | 2;
|
|
68
|
+
protocol: "openai-responses" | "openai-chat" | "anthropic" | "gemini";
|
|
69
|
+
baseURL: string;
|
|
69
70
|
}[];
|
|
70
71
|
selectedProfile?: string;
|
|
71
72
|
defaultProfile?: string;
|
package/dist/configuration.js
CHANGED
|
@@ -26,10 +26,10 @@ export const capabilities = z.strictObject({
|
|
|
26
26
|
responses: responseCapabilities,
|
|
27
27
|
});
|
|
28
28
|
export const defaultCapabilities = {
|
|
29
|
-
contextWindow:
|
|
30
|
-
maxOutputTokens:
|
|
29
|
+
contextWindow: 128000,
|
|
30
|
+
maxOutputTokens: 16384,
|
|
31
31
|
tools: true,
|
|
32
|
-
parallelToolCalls:
|
|
32
|
+
parallelToolCalls: true,
|
|
33
33
|
structuredOutput: false,
|
|
34
34
|
streaming: true,
|
|
35
35
|
images: false,
|
|
@@ -67,11 +67,12 @@ declare function createModelService(ctx: Context, options: ModelResponsesOptions
|
|
|
67
67
|
reasoningEfforts: string[];
|
|
68
68
|
modelId: string;
|
|
69
69
|
reasoningEffort?: string;
|
|
70
|
-
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini";
|
|
71
70
|
name: string;
|
|
72
71
|
providerId: string;
|
|
73
72
|
revision: string;
|
|
74
73
|
codecVersion: 1 | 2;
|
|
74
|
+
protocol: "openai-responses" | "openai-chat" | "anthropic" | "gemini";
|
|
75
|
+
baseURL: string;
|
|
75
76
|
}[];
|
|
76
77
|
selectedProfile?: string;
|
|
77
78
|
defaultProfile?: string;
|
|
@@ -190,17 +190,22 @@ function createModelService(ctx, options) {
|
|
|
190
190
|
selectedProfile: catalog.profiles.find((p) => canonicalJson(profileModel(p)) === canonicalJson(defaultModel)).name,
|
|
191
191
|
}
|
|
192
192
|
: {}),
|
|
193
|
-
profiles: catalog.profiles.map((p) =>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
193
|
+
profiles: catalog.profiles.map((p) => {
|
|
194
|
+
const model = profileModel(p);
|
|
195
|
+
const { profile, binding } = providers.resolve(model);
|
|
196
|
+
return {
|
|
197
|
+
name: p.name,
|
|
198
|
+
providerId: p.providerId,
|
|
199
|
+
revision: p.revision,
|
|
200
|
+
codecVersion: p.codecVersion,
|
|
201
|
+
protocol: profile.protocol,
|
|
202
|
+
baseURL: profile.baseURL,
|
|
203
|
+
...defaultModelDisplay(model, p.defaultReasoningEffort),
|
|
204
|
+
capabilityDigest: binding.capabilityDigest,
|
|
205
|
+
...profilePricing(p),
|
|
206
|
+
ready: Boolean(credential(p.credentialRef)?.trim()),
|
|
207
|
+
};
|
|
208
|
+
}),
|
|
204
209
|
}
|
|
205
210
|
: {}),
|
|
206
211
|
};
|
package/dist/modes.js
CHANGED
|
@@ -20,6 +20,7 @@ export const BUILTIN_MODES = [
|
|
|
20
20
|
description: '通用编程与工程任务模式(标准系统提示词与工具层,不加载安全插件)',
|
|
21
21
|
builtin: true,
|
|
22
22
|
tools: {
|
|
23
|
+
workspaceTools: true,
|
|
23
24
|
builtinAgentTools: true,
|
|
24
25
|
},
|
|
25
26
|
plugins: [],
|
|
@@ -439,6 +440,11 @@ export function resolveActiveMode(catalog, requested) {
|
|
|
439
440
|
definition.ref,
|
|
440
441
|
{ definition, budget: definition.limits ? { defaults: definition.limits } : {} },
|
|
441
442
|
]));
|
|
443
|
+
// The global setting overrides the built-in default; an explicit mode setting still takes precedence.
|
|
444
|
+
if (catalog?.workspaceTools !== undefined) {
|
|
445
|
+
const defaultMode = registry.get(DEFAULT_MODE_REF);
|
|
446
|
+
registry.set(DEFAULT_MODE_REF, configureMode(DEFAULT_MODE_REF, { tools: { workspace_tools: catalog.workspaceTools } }, defaultMode));
|
|
447
|
+
}
|
|
442
448
|
for (const [ref, raw] of Object.entries(catalog?.modes ?? {})) {
|
|
443
449
|
registry.set(ref, configureMode(ref, raw, registry.get(ref)));
|
|
444
450
|
}
|
|
@@ -59,16 +59,69 @@ declare const teamPresetSchema: z.ZodObject<{
|
|
|
59
59
|
}, z.core.$strict>;
|
|
60
60
|
declare const provider: z.ZodObject<{
|
|
61
61
|
base_url: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
62
|
-
protocol: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
63
|
-
"openai-responses": "openai-responses";
|
|
64
|
-
"openai-chat": "openai-chat";
|
|
65
|
-
anthropic: "anthropic";
|
|
66
|
-
gemini: "gemini";
|
|
67
|
-
"anthropic-messages": "anthropic-messages";
|
|
68
|
-
"google-gemini": "google-gemini";
|
|
69
|
-
}>, z.ZodTransform<"openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined, "openai-responses" | "openai-chat" | "anthropic" | "gemini" | "anthropic-messages" | "google-gemini">>>;
|
|
70
62
|
credential_ref: z.ZodString;
|
|
71
|
-
models: z.ZodArray<z.ZodString
|
|
63
|
+
models: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPreprocess<z.ZodPipe<z.ZodArray<z.ZodTuple<[z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>, z.ZodObject<{
|
|
64
|
+
context_window: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
max_output_tokens: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
default_reasoning_effort: z.ZodOptional<z.ZodString>;
|
|
67
|
+
reasoning_model: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
reasoning_efforts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
+
tools: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
parallel_tool_calls: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
streaming: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
structured_output: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
images: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
pricing: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
input_per_million: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
cached_input_per_million: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
77
|
+
output_per_million: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
}, z.core.$strict>>;
|
|
79
|
+
protocol: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
80
|
+
"openai-responses": "openai-responses";
|
|
81
|
+
"openai-chat": "openai-chat";
|
|
82
|
+
anthropic: "anthropic";
|
|
83
|
+
gemini: "gemini";
|
|
84
|
+
"anthropic-messages": "anthropic-messages";
|
|
85
|
+
"google-gemini": "google-gemini";
|
|
86
|
+
}>, z.ZodTransform<"openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined, "openai-responses" | "openai-chat" | "anthropic" | "gemini" | "anthropic-messages" | "google-gemini">>>;
|
|
87
|
+
base_url: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
88
|
+
}, z.core.$strict>], null>>, z.ZodTransform<Record<string, {
|
|
89
|
+
context_window?: number | undefined;
|
|
90
|
+
max_output_tokens?: number | undefined;
|
|
91
|
+
default_reasoning_effort?: string | undefined;
|
|
92
|
+
reasoning_model?: boolean | undefined;
|
|
93
|
+
reasoning_efforts?: string[] | undefined;
|
|
94
|
+
tools?: boolean | undefined;
|
|
95
|
+
parallel_tool_calls?: boolean | undefined;
|
|
96
|
+
streaming?: boolean | undefined;
|
|
97
|
+
structured_output?: boolean | undefined;
|
|
98
|
+
images?: boolean | undefined;
|
|
99
|
+
pricing?: {
|
|
100
|
+
input_per_million?: number | undefined;
|
|
101
|
+
cached_input_per_million?: number | undefined;
|
|
102
|
+
output_per_million?: number | undefined;
|
|
103
|
+
} | undefined;
|
|
104
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
105
|
+
base_url?: string | undefined;
|
|
106
|
+
}>, [string, {
|
|
107
|
+
context_window?: number | undefined;
|
|
108
|
+
max_output_tokens?: number | undefined;
|
|
109
|
+
default_reasoning_effort?: string | undefined;
|
|
110
|
+
reasoning_model?: boolean | undefined;
|
|
111
|
+
reasoning_efforts?: string[] | undefined;
|
|
112
|
+
tools?: boolean | undefined;
|
|
113
|
+
parallel_tool_calls?: boolean | undefined;
|
|
114
|
+
streaming?: boolean | undefined;
|
|
115
|
+
structured_output?: boolean | undefined;
|
|
116
|
+
images?: boolean | undefined;
|
|
117
|
+
pricing?: {
|
|
118
|
+
input_per_million?: number | undefined;
|
|
119
|
+
cached_input_per_million?: number | undefined;
|
|
120
|
+
output_per_million?: number | undefined;
|
|
121
|
+
} | undefined;
|
|
122
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
123
|
+
base_url?: string | undefined;
|
|
124
|
+
}][]>>, unknown>]>;
|
|
72
125
|
revision: z.ZodOptional<z.ZodString>;
|
|
73
126
|
codec_version: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
|
|
74
127
|
default_reasoning_effort: z.ZodOptional<z.ZodString>;
|
|
@@ -81,12 +134,22 @@ declare const provider: z.ZodObject<{
|
|
|
81
134
|
tools: z.ZodOptional<z.ZodBoolean>;
|
|
82
135
|
parallel_tool_calls: z.ZodOptional<z.ZodBoolean>;
|
|
83
136
|
streaming: z.ZodOptional<z.ZodBoolean>;
|
|
137
|
+
structured_output: z.ZodOptional<z.ZodBoolean>;
|
|
84
138
|
images: z.ZodOptional<z.ZodBoolean>;
|
|
85
139
|
pricing: z.ZodOptional<z.ZodObject<{
|
|
86
140
|
input_per_million: z.ZodOptional<z.ZodNumber>;
|
|
87
141
|
cached_input_per_million: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
88
142
|
output_per_million: z.ZodOptional<z.ZodNumber>;
|
|
89
143
|
}, z.core.$strict>>;
|
|
144
|
+
protocol: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
145
|
+
"openai-responses": "openai-responses";
|
|
146
|
+
"openai-chat": "openai-chat";
|
|
147
|
+
anthropic: "anthropic";
|
|
148
|
+
gemini: "gemini";
|
|
149
|
+
"anthropic-messages": "anthropic-messages";
|
|
150
|
+
"google-gemini": "google-gemini";
|
|
151
|
+
}>, z.ZodTransform<"openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined, "openai-responses" | "openai-chat" | "anthropic" | "gemini" | "anthropic-messages" | "google-gemini">>>;
|
|
152
|
+
base_url: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
90
153
|
}, z.core.$strict>], null>>, z.ZodTransform<Record<string, {
|
|
91
154
|
context_window?: number | undefined;
|
|
92
155
|
max_output_tokens?: number | undefined;
|
|
@@ -96,12 +159,15 @@ declare const provider: z.ZodObject<{
|
|
|
96
159
|
tools?: boolean | undefined;
|
|
97
160
|
parallel_tool_calls?: boolean | undefined;
|
|
98
161
|
streaming?: boolean | undefined;
|
|
162
|
+
structured_output?: boolean | undefined;
|
|
99
163
|
images?: boolean | undefined;
|
|
100
164
|
pricing?: {
|
|
101
165
|
input_per_million?: number | undefined;
|
|
102
166
|
cached_input_per_million?: number | undefined;
|
|
103
167
|
output_per_million?: number | undefined;
|
|
104
168
|
} | undefined;
|
|
169
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
170
|
+
base_url?: string | undefined;
|
|
105
171
|
}>, [string, {
|
|
106
172
|
context_window?: number | undefined;
|
|
107
173
|
max_output_tokens?: number | undefined;
|
|
@@ -111,13 +177,24 @@ declare const provider: z.ZodObject<{
|
|
|
111
177
|
tools?: boolean | undefined;
|
|
112
178
|
parallel_tool_calls?: boolean | undefined;
|
|
113
179
|
streaming?: boolean | undefined;
|
|
180
|
+
structured_output?: boolean | undefined;
|
|
114
181
|
images?: boolean | undefined;
|
|
115
182
|
pricing?: {
|
|
116
183
|
input_per_million?: number | undefined;
|
|
117
184
|
cached_input_per_million?: number | undefined;
|
|
118
185
|
output_per_million?: number | undefined;
|
|
119
186
|
} | undefined;
|
|
187
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
188
|
+
base_url?: string | undefined;
|
|
120
189
|
}][]>>, unknown>>;
|
|
190
|
+
protocol: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
191
|
+
"openai-responses": "openai-responses";
|
|
192
|
+
"openai-chat": "openai-chat";
|
|
193
|
+
anthropic: "anthropic";
|
|
194
|
+
gemini: "gemini";
|
|
195
|
+
"anthropic-messages": "anthropic-messages";
|
|
196
|
+
"google-gemini": "google-gemini";
|
|
197
|
+
}>, z.ZodTransform<"openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined, "openai-responses" | "openai-chat" | "anthropic" | "gemini" | "anthropic-messages" | "google-gemini">>>;
|
|
121
198
|
}, z.core.$strict>;
|
|
122
199
|
declare const catalogSchema: z.ZodObject<{
|
|
123
200
|
version: z.ZodLiteral<1>;
|
|
@@ -184,16 +261,69 @@ declare const catalogSchema: z.ZodObject<{
|
|
|
184
261
|
}, z.core.$strict>>>;
|
|
185
262
|
providers: z.ZodOptional<z.ZodPreprocess<z.ZodPipe<z.ZodArray<z.ZodTuple<[z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>, z.ZodObject<{
|
|
186
263
|
base_url: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
187
|
-
protocol: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
188
|
-
"openai-responses": "openai-responses";
|
|
189
|
-
"openai-chat": "openai-chat";
|
|
190
|
-
anthropic: "anthropic";
|
|
191
|
-
gemini: "gemini";
|
|
192
|
-
"anthropic-messages": "anthropic-messages";
|
|
193
|
-
"google-gemini": "google-gemini";
|
|
194
|
-
}>, z.ZodTransform<"openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined, "openai-responses" | "openai-chat" | "anthropic" | "gemini" | "anthropic-messages" | "google-gemini">>>;
|
|
195
264
|
credential_ref: z.ZodString;
|
|
196
|
-
models: z.ZodArray<z.ZodString
|
|
265
|
+
models: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPreprocess<z.ZodPipe<z.ZodArray<z.ZodTuple<[z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>, z.ZodObject<{
|
|
266
|
+
context_window: z.ZodOptional<z.ZodNumber>;
|
|
267
|
+
max_output_tokens: z.ZodOptional<z.ZodNumber>;
|
|
268
|
+
default_reasoning_effort: z.ZodOptional<z.ZodString>;
|
|
269
|
+
reasoning_model: z.ZodOptional<z.ZodBoolean>;
|
|
270
|
+
reasoning_efforts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
271
|
+
tools: z.ZodOptional<z.ZodBoolean>;
|
|
272
|
+
parallel_tool_calls: z.ZodOptional<z.ZodBoolean>;
|
|
273
|
+
streaming: z.ZodOptional<z.ZodBoolean>;
|
|
274
|
+
structured_output: z.ZodOptional<z.ZodBoolean>;
|
|
275
|
+
images: z.ZodOptional<z.ZodBoolean>;
|
|
276
|
+
pricing: z.ZodOptional<z.ZodObject<{
|
|
277
|
+
input_per_million: z.ZodOptional<z.ZodNumber>;
|
|
278
|
+
cached_input_per_million: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
279
|
+
output_per_million: z.ZodOptional<z.ZodNumber>;
|
|
280
|
+
}, z.core.$strict>>;
|
|
281
|
+
protocol: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
282
|
+
"openai-responses": "openai-responses";
|
|
283
|
+
"openai-chat": "openai-chat";
|
|
284
|
+
anthropic: "anthropic";
|
|
285
|
+
gemini: "gemini";
|
|
286
|
+
"anthropic-messages": "anthropic-messages";
|
|
287
|
+
"google-gemini": "google-gemini";
|
|
288
|
+
}>, z.ZodTransform<"openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined, "openai-responses" | "openai-chat" | "anthropic" | "gemini" | "anthropic-messages" | "google-gemini">>>;
|
|
289
|
+
base_url: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
290
|
+
}, z.core.$strict>], null>>, z.ZodTransform<Record<string, {
|
|
291
|
+
context_window?: number | undefined;
|
|
292
|
+
max_output_tokens?: number | undefined;
|
|
293
|
+
default_reasoning_effort?: string | undefined;
|
|
294
|
+
reasoning_model?: boolean | undefined;
|
|
295
|
+
reasoning_efforts?: string[] | undefined;
|
|
296
|
+
tools?: boolean | undefined;
|
|
297
|
+
parallel_tool_calls?: boolean | undefined;
|
|
298
|
+
streaming?: boolean | undefined;
|
|
299
|
+
structured_output?: boolean | undefined;
|
|
300
|
+
images?: boolean | undefined;
|
|
301
|
+
pricing?: {
|
|
302
|
+
input_per_million?: number | undefined;
|
|
303
|
+
cached_input_per_million?: number | undefined;
|
|
304
|
+
output_per_million?: number | undefined;
|
|
305
|
+
} | undefined;
|
|
306
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
307
|
+
base_url?: string | undefined;
|
|
308
|
+
}>, [string, {
|
|
309
|
+
context_window?: number | undefined;
|
|
310
|
+
max_output_tokens?: number | undefined;
|
|
311
|
+
default_reasoning_effort?: string | undefined;
|
|
312
|
+
reasoning_model?: boolean | undefined;
|
|
313
|
+
reasoning_efforts?: string[] | undefined;
|
|
314
|
+
tools?: boolean | undefined;
|
|
315
|
+
parallel_tool_calls?: boolean | undefined;
|
|
316
|
+
streaming?: boolean | undefined;
|
|
317
|
+
structured_output?: boolean | undefined;
|
|
318
|
+
images?: boolean | undefined;
|
|
319
|
+
pricing?: {
|
|
320
|
+
input_per_million?: number | undefined;
|
|
321
|
+
cached_input_per_million?: number | undefined;
|
|
322
|
+
output_per_million?: number | undefined;
|
|
323
|
+
} | undefined;
|
|
324
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
325
|
+
base_url?: string | undefined;
|
|
326
|
+
}][]>>, unknown>]>;
|
|
197
327
|
revision: z.ZodOptional<z.ZodString>;
|
|
198
328
|
codec_version: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
|
|
199
329
|
default_reasoning_effort: z.ZodOptional<z.ZodString>;
|
|
@@ -206,12 +336,22 @@ declare const catalogSchema: z.ZodObject<{
|
|
|
206
336
|
tools: z.ZodOptional<z.ZodBoolean>;
|
|
207
337
|
parallel_tool_calls: z.ZodOptional<z.ZodBoolean>;
|
|
208
338
|
streaming: z.ZodOptional<z.ZodBoolean>;
|
|
339
|
+
structured_output: z.ZodOptional<z.ZodBoolean>;
|
|
209
340
|
images: z.ZodOptional<z.ZodBoolean>;
|
|
210
341
|
pricing: z.ZodOptional<z.ZodObject<{
|
|
211
342
|
input_per_million: z.ZodOptional<z.ZodNumber>;
|
|
212
343
|
cached_input_per_million: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
213
344
|
output_per_million: z.ZodOptional<z.ZodNumber>;
|
|
214
345
|
}, z.core.$strict>>;
|
|
346
|
+
protocol: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
347
|
+
"openai-responses": "openai-responses";
|
|
348
|
+
"openai-chat": "openai-chat";
|
|
349
|
+
anthropic: "anthropic";
|
|
350
|
+
gemini: "gemini";
|
|
351
|
+
"anthropic-messages": "anthropic-messages";
|
|
352
|
+
"google-gemini": "google-gemini";
|
|
353
|
+
}>, z.ZodTransform<"openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined, "openai-responses" | "openai-chat" | "anthropic" | "gemini" | "anthropic-messages" | "google-gemini">>>;
|
|
354
|
+
base_url: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
215
355
|
}, z.core.$strict>], null>>, z.ZodTransform<Record<string, {
|
|
216
356
|
context_window?: number | undefined;
|
|
217
357
|
max_output_tokens?: number | undefined;
|
|
@@ -221,12 +361,15 @@ declare const catalogSchema: z.ZodObject<{
|
|
|
221
361
|
tools?: boolean | undefined;
|
|
222
362
|
parallel_tool_calls?: boolean | undefined;
|
|
223
363
|
streaming?: boolean | undefined;
|
|
364
|
+
structured_output?: boolean | undefined;
|
|
224
365
|
images?: boolean | undefined;
|
|
225
366
|
pricing?: {
|
|
226
367
|
input_per_million?: number | undefined;
|
|
227
368
|
cached_input_per_million?: number | undefined;
|
|
228
369
|
output_per_million?: number | undefined;
|
|
229
370
|
} | undefined;
|
|
371
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
372
|
+
base_url?: string | undefined;
|
|
230
373
|
}>, [string, {
|
|
231
374
|
context_window?: number | undefined;
|
|
232
375
|
max_output_tokens?: number | undefined;
|
|
@@ -236,18 +379,46 @@ declare const catalogSchema: z.ZodObject<{
|
|
|
236
379
|
tools?: boolean | undefined;
|
|
237
380
|
parallel_tool_calls?: boolean | undefined;
|
|
238
381
|
streaming?: boolean | undefined;
|
|
382
|
+
structured_output?: boolean | undefined;
|
|
239
383
|
images?: boolean | undefined;
|
|
240
384
|
pricing?: {
|
|
241
385
|
input_per_million?: number | undefined;
|
|
242
386
|
cached_input_per_million?: number | undefined;
|
|
243
387
|
output_per_million?: number | undefined;
|
|
244
388
|
} | undefined;
|
|
389
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
390
|
+
base_url?: string | undefined;
|
|
245
391
|
}][]>>, unknown>>;
|
|
392
|
+
protocol: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
393
|
+
"openai-responses": "openai-responses";
|
|
394
|
+
"openai-chat": "openai-chat";
|
|
395
|
+
anthropic: "anthropic";
|
|
396
|
+
gemini: "gemini";
|
|
397
|
+
"anthropic-messages": "anthropic-messages";
|
|
398
|
+
"google-gemini": "google-gemini";
|
|
399
|
+
}>, z.ZodTransform<"openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined, "openai-responses" | "openai-chat" | "anthropic" | "gemini" | "anthropic-messages" | "google-gemini">>>;
|
|
246
400
|
}, z.core.$strict>], null>>, z.ZodTransform<Record<string, {
|
|
247
401
|
base_url: string;
|
|
248
402
|
credential_ref: string;
|
|
249
|
-
models: string[]
|
|
250
|
-
|
|
403
|
+
models: string[] | Record<string, {
|
|
404
|
+
context_window?: number | undefined;
|
|
405
|
+
max_output_tokens?: number | undefined;
|
|
406
|
+
default_reasoning_effort?: string | undefined;
|
|
407
|
+
reasoning_model?: boolean | undefined;
|
|
408
|
+
reasoning_efforts?: string[] | undefined;
|
|
409
|
+
tools?: boolean | undefined;
|
|
410
|
+
parallel_tool_calls?: boolean | undefined;
|
|
411
|
+
streaming?: boolean | undefined;
|
|
412
|
+
structured_output?: boolean | undefined;
|
|
413
|
+
images?: boolean | undefined;
|
|
414
|
+
pricing?: {
|
|
415
|
+
input_per_million?: number | undefined;
|
|
416
|
+
cached_input_per_million?: number | undefined;
|
|
417
|
+
output_per_million?: number | undefined;
|
|
418
|
+
} | undefined;
|
|
419
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
420
|
+
base_url?: string | undefined;
|
|
421
|
+
}>;
|
|
251
422
|
revision?: string | undefined;
|
|
252
423
|
codec_version?: 1 | 2 | undefined;
|
|
253
424
|
default_reasoning_effort?: string | undefined;
|
|
@@ -260,18 +431,39 @@ declare const catalogSchema: z.ZodObject<{
|
|
|
260
431
|
tools?: boolean | undefined;
|
|
261
432
|
parallel_tool_calls?: boolean | undefined;
|
|
262
433
|
streaming?: boolean | undefined;
|
|
434
|
+
structured_output?: boolean | undefined;
|
|
263
435
|
images?: boolean | undefined;
|
|
264
436
|
pricing?: {
|
|
265
437
|
input_per_million?: number | undefined;
|
|
266
438
|
cached_input_per_million?: number | undefined;
|
|
267
439
|
output_per_million?: number | undefined;
|
|
268
440
|
} | undefined;
|
|
441
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
442
|
+
base_url?: string | undefined;
|
|
269
443
|
}> | undefined;
|
|
444
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
270
445
|
}>, [string, {
|
|
271
446
|
base_url: string;
|
|
272
447
|
credential_ref: string;
|
|
273
|
-
models: string[]
|
|
274
|
-
|
|
448
|
+
models: string[] | Record<string, {
|
|
449
|
+
context_window?: number | undefined;
|
|
450
|
+
max_output_tokens?: number | undefined;
|
|
451
|
+
default_reasoning_effort?: string | undefined;
|
|
452
|
+
reasoning_model?: boolean | undefined;
|
|
453
|
+
reasoning_efforts?: string[] | undefined;
|
|
454
|
+
tools?: boolean | undefined;
|
|
455
|
+
parallel_tool_calls?: boolean | undefined;
|
|
456
|
+
streaming?: boolean | undefined;
|
|
457
|
+
structured_output?: boolean | undefined;
|
|
458
|
+
images?: boolean | undefined;
|
|
459
|
+
pricing?: {
|
|
460
|
+
input_per_million?: number | undefined;
|
|
461
|
+
cached_input_per_million?: number | undefined;
|
|
462
|
+
output_per_million?: number | undefined;
|
|
463
|
+
} | undefined;
|
|
464
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
465
|
+
base_url?: string | undefined;
|
|
466
|
+
}>;
|
|
275
467
|
revision?: string | undefined;
|
|
276
468
|
codec_version?: 1 | 2 | undefined;
|
|
277
469
|
default_reasoning_effort?: string | undefined;
|
|
@@ -284,13 +476,17 @@ declare const catalogSchema: z.ZodObject<{
|
|
|
284
476
|
tools?: boolean | undefined;
|
|
285
477
|
parallel_tool_calls?: boolean | undefined;
|
|
286
478
|
streaming?: boolean | undefined;
|
|
479
|
+
structured_output?: boolean | undefined;
|
|
287
480
|
images?: boolean | undefined;
|
|
288
481
|
pricing?: {
|
|
289
482
|
input_per_million?: number | undefined;
|
|
290
483
|
cached_input_per_million?: number | undefined;
|
|
291
484
|
output_per_million?: number | undefined;
|
|
292
485
|
} | undefined;
|
|
486
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
487
|
+
base_url?: string | undefined;
|
|
293
488
|
}> | undefined;
|
|
489
|
+
protocol?: "openai-responses" | "openai-chat" | "anthropic" | "gemini" | undefined;
|
|
294
490
|
}][]>>, unknown>>;
|
|
295
491
|
task_profiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
296
492
|
run_defaults: z.ZodOptional<z.ZodObject<{
|
package/dist/provider-catalog.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { webSearchConfig } from './user-config.js';
|
|
3
3
|
import { parse, stringify } from 'smol-toml';
|
|
4
|
-
import { DEFAULT_MODE_REF, RuntimeError, lookupModelMetadata,
|
|
5
|
-
import { credentialRefSchema, providerIdSchema } from '@saturn-universe/protocol';
|
|
4
|
+
import { DEFAULT_MODE_REF, RuntimeError, lookupModelMetadata, openCodeClientHeaders, providerPresets, validateTeamConfig, validateWorkSubpath, } from '@saturn-universe/core';
|
|
5
|
+
import { credentialRefSchema, providerBaseUrlSchema, providerIdSchema, providerModelIdSchema, providerModelRouteSchema, } from '@saturn-universe/protocol';
|
|
6
6
|
import { maxShellTimeoutMs } from '@saturn-universe/tools';
|
|
7
7
|
import { capabilities, defaultCapabilities } from './configuration.js';
|
|
8
8
|
import { mcpServersSchema } from './mcp-configuration.js';
|
|
@@ -19,19 +19,12 @@ const pricingSchema = z.strictObject({
|
|
|
19
19
|
output_per_million: nonnegativeNumber,
|
|
20
20
|
});
|
|
21
21
|
const codecVersion = z.union([z.literal(1), z.literal(2)]);
|
|
22
|
-
const baseUrl = z.string().transform((value, ctx) => {
|
|
23
|
-
const url = normalizeProviderBaseUrl(value);
|
|
24
|
-
if (url !== undefined)
|
|
25
|
-
return url;
|
|
26
|
-
ctx.addIssue({ code: 'custom', message: 'Invalid endpoint' });
|
|
27
|
-
return z.NEVER;
|
|
28
|
-
});
|
|
29
22
|
const profile = z
|
|
30
23
|
.strictObject({
|
|
31
24
|
provider_id: id,
|
|
32
25
|
revision: id,
|
|
33
26
|
codec_version: codecVersion,
|
|
34
|
-
base_url:
|
|
27
|
+
base_url: providerBaseUrlSchema,
|
|
35
28
|
model_id: id,
|
|
36
29
|
credential_ref: credentialRefSchema,
|
|
37
30
|
default_reasoning_effort: id.optional(),
|
|
@@ -85,6 +78,7 @@ const teamPresetSchema = z.strictObject({
|
|
|
85
78
|
.max(15),
|
|
86
79
|
});
|
|
87
80
|
const modelOverride = z.strictObject({
|
|
81
|
+
...providerModelRouteSchema.shape,
|
|
88
82
|
context_window: positive.optional(),
|
|
89
83
|
max_output_tokens: positive.optional(),
|
|
90
84
|
default_reasoning_effort: id.optional(),
|
|
@@ -93,19 +87,23 @@ const modelOverride = z.strictObject({
|
|
|
93
87
|
tools: z.boolean().optional(),
|
|
94
88
|
parallel_tool_calls: z.boolean().optional(),
|
|
95
89
|
streaming: z.boolean().optional(),
|
|
90
|
+
structured_output: z.boolean().optional(),
|
|
96
91
|
images: z.boolean().optional(),
|
|
97
92
|
pricing: pricingSchema.partial().optional(),
|
|
98
93
|
});
|
|
99
94
|
const provider = z
|
|
100
95
|
.strictObject({
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
...providerModelRouteSchema.shape,
|
|
97
|
+
base_url: providerBaseUrlSchema,
|
|
103
98
|
credential_ref: credentialRefSchema,
|
|
104
|
-
models: z.
|
|
99
|
+
models: z.union([
|
|
100
|
+
z.array(providerModelIdSchema).min(1),
|
|
101
|
+
configurationTable(providerModelIdSchema, modelOverride).refine((models) => Object.keys(models).length > 0),
|
|
102
|
+
]),
|
|
105
103
|
revision: id.optional(),
|
|
106
104
|
codec_version: codecVersion.optional(),
|
|
107
105
|
default_reasoning_effort: id.optional(),
|
|
108
|
-
model_overrides: configurationTable(
|
|
106
|
+
model_overrides: configurationTable(providerModelIdSchema, modelOverride).optional(),
|
|
109
107
|
})
|
|
110
108
|
.refine((value) => value.codec_version !== 2 || (value.revision ?? '1') !== '1');
|
|
111
109
|
const catalogSchema = z.strictObject({
|
|
@@ -172,10 +170,11 @@ export function parseProviderCatalog(value) {
|
|
|
172
170
|
};
|
|
173
171
|
});
|
|
174
172
|
for (const [providerId, value] of Object.entries(data.providers ?? {})) {
|
|
173
|
+
const models = Array.isArray(value.models) ? value.models : Object.keys(value.models);
|
|
175
174
|
if (`${providerId}@${value.revision ?? '1'}`.length > 200 ||
|
|
176
|
-
Object.keys(value.model_overrides ?? {}).some((model) => !
|
|
175
|
+
Object.keys(value.model_overrides ?? {}).some((model) => !models.includes(model)))
|
|
177
176
|
throw invalid();
|
|
178
|
-
for (const modelId of
|
|
177
|
+
for (const modelId of models)
|
|
179
178
|
profiles.push(expandProfile(providerId, modelId, value));
|
|
180
179
|
}
|
|
181
180
|
if (!data.providers && !data.profiles)
|
|
@@ -192,12 +191,8 @@ export function parseProviderCatalog(value) {
|
|
|
192
191
|
throw invalid();
|
|
193
192
|
identities.add(identity);
|
|
194
193
|
const revisionRef = `${p.providerId}@${p.revision}`;
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
p.credentialRef,
|
|
198
|
-
p.codecVersion,
|
|
199
|
-
p.protocol ?? 'openai-responses',
|
|
200
|
-
]);
|
|
194
|
+
const route = providerRoute(p, data.providers);
|
|
195
|
+
const binding = JSON.stringify([route.baseURL, p.credentialRef, p.codecVersion, route.protocol]);
|
|
201
196
|
if (revisions.has(revisionRef) && revisions.get(revisionRef) !== binding)
|
|
202
197
|
throw invalid();
|
|
203
198
|
revisions.set(revisionRef, binding);
|
|
@@ -229,13 +224,17 @@ function expandProfile(providerId, modelId, value) {
|
|
|
229
224
|
if (name.length > 200)
|
|
230
225
|
throw invalid();
|
|
231
226
|
const model = lookupModelMetadata(modelId);
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
227
|
+
const legacy = value.model_overrides;
|
|
228
|
+
const models = Array.isArray(value.models) ? undefined : value.models;
|
|
229
|
+
const override = {
|
|
230
|
+
...(legacy && Object.hasOwn(legacy, modelId) ? legacy[modelId] : {}),
|
|
231
|
+
...(models && Object.hasOwn(models, modelId) ? models[modelId] : {}),
|
|
232
|
+
};
|
|
235
233
|
const reasoningModel = override?.reasoning_model ?? model?.reasoningModel ?? Boolean(override?.reasoning_efforts?.length);
|
|
236
234
|
const tools = override?.tools ?? model?.tools ?? defaultCapabilities.tools;
|
|
237
|
-
const parallelToolCalls = override?.parallel_tool_calls ??
|
|
238
|
-
|
|
235
|
+
const parallelToolCalls = override?.parallel_tool_calls ??
|
|
236
|
+
(tools && (model?.parallelToolCalls ?? defaultCapabilities.parallelToolCalls));
|
|
237
|
+
const protocol = override.protocol ?? value.protocol ?? 'openai-responses';
|
|
239
238
|
const input = override?.pricing?.input_per_million ?? model?.pricing.inputPerMillion;
|
|
240
239
|
const output = override?.pricing?.output_per_million ?? model?.pricing.outputPerMillion;
|
|
241
240
|
const cached = override?.pricing?.cached_input_per_million ?? model?.pricing.cachedInputPerMillion;
|
|
@@ -247,7 +246,7 @@ function expandProfile(providerId, modelId, value) {
|
|
|
247
246
|
providerId,
|
|
248
247
|
revision: value.revision ?? '1',
|
|
249
248
|
codecVersion: value.codec_version ?? 1,
|
|
250
|
-
baseURL: value.base_url,
|
|
249
|
+
baseURL: override.base_url ?? value.base_url,
|
|
251
250
|
modelId,
|
|
252
251
|
credentialRef: value.credential_ref,
|
|
253
252
|
protocol,
|
|
@@ -259,6 +258,7 @@ function expandProfile(providerId, modelId, value) {
|
|
|
259
258
|
tools,
|
|
260
259
|
parallelToolCalls,
|
|
261
260
|
streaming: override?.streaming ?? model?.streaming ?? defaultCapabilities.streaming,
|
|
261
|
+
structuredOutput: override.structured_output ?? defaultCapabilities.structuredOutput,
|
|
262
262
|
images: override?.images ?? model?.images ?? defaultCapabilities.images,
|
|
263
263
|
responses: {
|
|
264
264
|
...defaultCapabilities.responses,
|
|
@@ -342,24 +342,42 @@ export const profileModel = (p) => ({
|
|
|
342
342
|
modelId: p.modelId,
|
|
343
343
|
profileRef: `${p.providerId}@${p.revision}`,
|
|
344
344
|
});
|
|
345
|
+
function providerRoute(p, providers) {
|
|
346
|
+
const layered = p.protocol && providers && Object.hasOwn(providers, p.providerId) ? providers[p.providerId] : undefined;
|
|
347
|
+
return {
|
|
348
|
+
baseURL: layered?.base_url ?? p.baseURL,
|
|
349
|
+
protocol: (layered ? layered.protocol : p.protocol) ?? 'openai-responses',
|
|
350
|
+
};
|
|
351
|
+
}
|
|
345
352
|
export function catalogRegistrations(catalog) {
|
|
346
353
|
const groups = new Map();
|
|
347
354
|
for (const p of catalog.profiles) {
|
|
348
355
|
const ref = profileModel(p).profileRef;
|
|
356
|
+
const route = providerRoute(p, catalog.providers);
|
|
357
|
+
const modelRoute = {
|
|
358
|
+
...(p.protocol && p.protocol !== route.protocol ? { protocol: p.protocol } : {}),
|
|
359
|
+
...(p.baseURL !== route.baseURL ? { baseURL: p.baseURL } : {}),
|
|
360
|
+
};
|
|
361
|
+
const previous = groups.get(ref);
|
|
362
|
+
const modelRoutes = {
|
|
363
|
+
...previous?.modelRoutes,
|
|
364
|
+
...(Object.keys(modelRoute).length ? { [p.modelId]: modelRoute } : {}),
|
|
365
|
+
};
|
|
349
366
|
const entry = {
|
|
350
367
|
id: p.providerId,
|
|
351
368
|
revision: p.revision,
|
|
352
|
-
|
|
353
|
-
baseURL: p.baseURL,
|
|
369
|
+
...route,
|
|
354
370
|
apiKeyRef: p.credentialRef,
|
|
355
|
-
headers:
|
|
371
|
+
headers: providerPresets.some((preset) => preset.id === p.providerId && preset.openCodeModelsUrl)
|
|
372
|
+
? { 'x-opencode-client': { kind: 'literal', value: openCodeClientHeaders['x-opencode-client'] } }
|
|
373
|
+
: {},
|
|
356
374
|
credentialScopeRef: p.credentialRef,
|
|
357
375
|
codecId: 'saturn-responses',
|
|
358
376
|
codecVersion: p.codecVersion,
|
|
359
|
-
models: { [p.modelId]: p.capabilities ?? defaultCapabilities },
|
|
377
|
+
models: { ...previous?.models, [p.modelId]: p.capabilities ?? defaultCapabilities },
|
|
378
|
+
...(Object.keys(modelRoutes).length ? { modelRoutes } : {}),
|
|
360
379
|
};
|
|
361
|
-
|
|
362
|
-
groups.set(ref, previous ? { ...previous, models: { ...previous.models, ...entry.models } } : entry);
|
|
380
|
+
groups.set(ref, entry);
|
|
363
381
|
}
|
|
364
382
|
return [...groups.values()];
|
|
365
383
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saturn-universe/runtime-host",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2-dev.2",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
],
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@deepseek-ai/cordis": "4.1.0",
|
|
11
|
-
"@saturn-universe/context": "0.1.
|
|
12
|
-
"@saturn-universe/core": "0.1.
|
|
13
|
-
"@saturn-universe/model": "0.1.
|
|
14
|
-
"@saturn-universe/plugin-sdk": "0.1.
|
|
15
|
-
"@saturn-universe/protocol": "0.1.
|
|
16
|
-
"@saturn-universe/runtime": "0.1.
|
|
17
|
-
"@saturn-universe/storage": "0.1.
|
|
18
|
-
"@saturn-universe/tools": "0.1.
|
|
11
|
+
"@saturn-universe/context": "0.1.2-dev.2",
|
|
12
|
+
"@saturn-universe/core": "0.1.2-dev.2",
|
|
13
|
+
"@saturn-universe/model": "0.1.2-dev.2",
|
|
14
|
+
"@saturn-universe/plugin-sdk": "0.1.2-dev.2",
|
|
15
|
+
"@saturn-universe/protocol": "0.1.2-dev.2",
|
|
16
|
+
"@saturn-universe/runtime": "0.1.2-dev.2",
|
|
17
|
+
"@saturn-universe/storage": "0.1.2-dev.2",
|
|
18
|
+
"@saturn-universe/tools": "0.1.2-dev.2",
|
|
19
19
|
"import-meta-resolve": "4.2.0",
|
|
20
20
|
"pino": "10.4.0",
|
|
21
21
|
"semver": "7.7.4",
|