@perstack/core 0.0.55 → 0.0.57

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/src/index.js CHANGED
@@ -157,6 +157,33 @@ var PerstackError = class extends Error {
157
157
  }
158
158
  };
159
159
 
160
+ //#endregion
161
+ //#region src/known-models/model-tiers.ts
162
+ const modelTierSchema = z.enum([
163
+ "low",
164
+ "middle",
165
+ "high"
166
+ ]);
167
+ /**
168
+ * Cloud-hosted providers that share model names with a base provider.
169
+ * Used to fall back when looking up models by tier.
170
+ */
171
+ const cloudProviderFallback = {
172
+ "azure-openai": "openai",
173
+ "amazon-bedrock": "anthropic",
174
+ "google-vertex": "google"
175
+ };
176
+ /**
177
+ * Resolve a model tier to a concrete model name for the given provider.
178
+ * Returns the first model matching the tier in the provider's known models list.
179
+ * For cloud-hosted providers (azure-openai, amazon-bedrock, google-vertex),
180
+ * falls back to their base provider's models.
181
+ */
182
+ function resolveModelTier(providerName, tier) {
183
+ const lookupProvider = cloudProviderFallback[providerName] ?? providerName;
184
+ return knownModels.find((p) => p.provider === lookupProvider)?.models.find((m) => m.tier === tier)?.name;
185
+ }
186
+
160
187
  //#endregion
161
188
  //#region src/known-models/index.ts
162
189
  const knownModels = [
@@ -165,46 +192,55 @@ const knownModels = [
165
192
  models: [
166
193
  {
167
194
  name: "claude-opus-4-6",
195
+ tier: "high",
168
196
  contextWindow: 2e5,
169
197
  maxOutputTokens: 128e3
170
198
  },
171
199
  {
172
200
  name: "claude-opus-4-5",
201
+ tier: "high",
173
202
  contextWindow: 2e5,
174
203
  maxOutputTokens: 32e3
175
204
  },
176
205
  {
177
206
  name: "claude-opus-4-1",
207
+ tier: "high",
178
208
  contextWindow: 2e5,
179
209
  maxOutputTokens: 32e3
180
210
  },
181
211
  {
182
212
  name: "claude-opus-4-20250514",
213
+ tier: "high",
183
214
  contextWindow: 2e5,
184
215
  maxOutputTokens: 32e3
185
216
  },
186
217
  {
187
218
  name: "claude-sonnet-4-5",
219
+ tier: "middle",
188
220
  contextWindow: 2e5,
189
221
  maxOutputTokens: 64e3
190
222
  },
191
223
  {
192
224
  name: "claude-sonnet-4-20250514",
225
+ tier: "middle",
193
226
  contextWindow: 2e5,
194
227
  maxOutputTokens: 64e3
195
228
  },
196
229
  {
197
230
  name: "claude-3-7-sonnet-20250219",
231
+ tier: "middle",
198
232
  contextWindow: 2e5,
199
233
  maxOutputTokens: 64e3
200
234
  },
201
235
  {
202
236
  name: "claude-haiku-4-5",
237
+ tier: "low",
203
238
  contextWindow: 2e5,
204
239
  maxOutputTokens: 8192
205
240
  },
206
241
  {
207
242
  name: "claude-3-5-haiku-latest",
243
+ tier: "low",
208
244
  contextWindow: 2e5,
209
245
  maxOutputTokens: 8192
210
246
  }
@@ -215,26 +251,31 @@ const knownModels = [
215
251
  models: [
216
252
  {
217
253
  name: "gemini-3-flash-preview",
254
+ tier: "middle",
218
255
  contextWindow: 1048576,
219
256
  maxOutputTokens: 65536
220
257
  },
221
258
  {
222
259
  name: "gemini-3-pro-preview",
260
+ tier: "high",
223
261
  contextWindow: 1048576,
224
262
  maxOutputTokens: 65536
225
263
  },
226
264
  {
227
265
  name: "gemini-2.5-pro",
266
+ tier: "high",
228
267
  contextWindow: 1048576,
229
268
  maxOutputTokens: 65536
230
269
  },
231
270
  {
232
271
  name: "gemini-2.5-flash",
272
+ tier: "middle",
233
273
  contextWindow: 1048576,
234
274
  maxOutputTokens: 65536
235
275
  },
236
276
  {
237
277
  name: "gemini-2.5-flash-lite",
278
+ tier: "low",
238
279
  contextWindow: 1048576,
239
280
  maxOutputTokens: 65536
240
281
  }
@@ -244,57 +285,68 @@ const knownModels = [
244
285
  provider: "openai",
245
286
  models: [
246
287
  {
247
- name: "gpt-5",
288
+ name: "gpt-5.2-pro",
289
+ tier: "high",
248
290
  contextWindow: 4e5,
249
291
  maxOutputTokens: 128e3
250
292
  },
251
293
  {
252
- name: "gpt-5-mini",
294
+ name: "gpt-5",
295
+ tier: "high",
253
296
  contextWindow: 4e5,
254
297
  maxOutputTokens: 128e3
255
298
  },
256
299
  {
257
- name: "gpt-5-nano",
300
+ name: "gpt-5-mini",
301
+ tier: "middle",
258
302
  contextWindow: 4e5,
259
303
  maxOutputTokens: 128e3
260
304
  },
261
305
  {
262
- name: "gpt-5.2",
306
+ name: "gpt-5-nano",
307
+ tier: "low",
263
308
  contextWindow: 4e5,
264
309
  maxOutputTokens: 128e3
265
310
  },
266
311
  {
267
- name: "gpt-5.2-pro",
312
+ name: "gpt-5.2",
313
+ tier: "middle",
268
314
  contextWindow: 4e5,
269
315
  maxOutputTokens: 128e3
270
316
  },
271
317
  {
272
318
  name: "gpt-5.1",
319
+ tier: "middle",
273
320
  contextWindow: 4e5,
274
321
  maxOutputTokens: 128e3
275
322
  },
276
323
  {
277
324
  name: "gpt-5-chat-latest",
325
+ tier: "middle",
278
326
  contextWindow: 128e3,
279
327
  maxOutputTokens: 16384
280
328
  },
281
329
  {
282
330
  name: "o4-mini",
331
+ tier: "middle",
283
332
  contextWindow: 2e5,
284
333
  maxOutputTokens: 1e5
285
334
  },
286
335
  {
287
336
  name: "o3",
337
+ tier: "high",
288
338
  contextWindow: 2e5,
289
339
  maxOutputTokens: 1e4
290
340
  },
291
341
  {
292
342
  name: "o3-mini",
343
+ tier: "middle",
293
344
  contextWindow: 2e5,
294
345
  maxOutputTokens: 1e4
295
346
  },
296
347
  {
297
348
  name: "gpt-4.1",
349
+ tier: "middle",
298
350
  contextWindow: 1047576,
299
351
  maxOutputTokens: 32768
300
352
  }
@@ -304,10 +356,12 @@ const knownModels = [
304
356
  provider: "deepseek",
305
357
  models: [{
306
358
  name: "deepseek-chat",
359
+ tier: "middle",
307
360
  contextWindow: 128e3,
308
361
  maxOutputTokens: 8192
309
362
  }, {
310
363
  name: "deepseek-reasoner",
364
+ tier: "high",
311
365
  contextWindow: 128e3,
312
366
  maxOutputTokens: 64e3
313
367
  }]
@@ -317,31 +371,37 @@ const knownModels = [
317
371
  models: [
318
372
  {
319
373
  name: "gpt-oss:20b",
374
+ tier: "middle",
320
375
  contextWindow: 131072,
321
376
  maxOutputTokens: 131072
322
377
  },
323
378
  {
324
379
  name: "gpt-oss:120b",
380
+ tier: "high",
325
381
  contextWindow: 131072,
326
382
  maxOutputTokens: 131072
327
383
  },
328
384
  {
329
385
  name: "gemma3:1b",
386
+ tier: "low",
330
387
  contextWindow: 32e3,
331
388
  maxOutputTokens: 32e3
332
389
  },
333
390
  {
334
391
  name: "gemma3:4b",
392
+ tier: "low",
335
393
  contextWindow: 128e3,
336
394
  maxOutputTokens: 128e3
337
395
  },
338
396
  {
339
397
  name: "gemma3:12b",
398
+ tier: "middle",
340
399
  contextWindow: 128e3,
341
400
  maxOutputTokens: 128e3
342
401
  },
343
402
  {
344
403
  name: "gemma3:27b",
404
+ tier: "middle",
345
405
  contextWindow: 128e3,
346
406
  maxOutputTokens: 128e3
347
407
  }
@@ -996,6 +1056,7 @@ const expertBaseSchema = z.object({
996
1056
  delegates: z.array(z.string().regex(expertKeyRegex).min(1)).optional().default([]),
997
1057
  tags: z.array(z.string().regex(tagNameRegex).min(1)).optional().default([]),
998
1058
  minRuntimeVersion: runtimeVersionSchema.default("v1.0"),
1059
+ defaultModelTier: modelTierSchema.optional(),
999
1060
  providerTools: z.array(z.string()).optional(),
1000
1061
  providerSkills: z.array(anthropicProviderSkillSchema).optional(),
1001
1062
  providerToolOptions: providerToolOptionsSchema
@@ -1245,6 +1306,7 @@ const perstackConfigSchema = z.object({
1245
1306
  minRuntimeVersion: runtimeVersionSchema.optional(),
1246
1307
  description: z.string().optional(),
1247
1308
  instruction: z.string(),
1309
+ defaultModelTier: modelTierSchema.optional(),
1248
1310
  skills: z.record(z.string(), z.discriminatedUnion("type", [
1249
1311
  z.object({
1250
1312
  type: z.literal("mcpStdioSkill"),
@@ -1979,5 +2041,5 @@ function parseWithFriendlyError(schema, data, context) {
1979
2041
  }
1980
2042
 
1981
2043
  //#endregion
1982
- export { BASE_SKILL_PREFIX, PerstackError, SAFE_ENV_VARS, activityOrGroupSchema, activitySchema, addDelegateActivitySchema, addSkillActivitySchema, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, anthropicProviderSkillSchema, anthropicProviderToolNameSchema, attemptCompletionActivitySchema, azureOpenAIProviderToolNameSchema, azureOpenAiProviderConfigSchema, basePartSchema, builtinAnthropicSkillSchema, callTools, checkpointSchema, checkpointStatusSchema, clearTodoActivitySchema, completeActivitySchema, completeRun, continueToNextStep, createBaseToolActivity, createCallToolsEvent, createCompleteRunEvent, createEmptyUsage, createEvent, createExpertActivitySchema, createFilteredEventListener, createGeneralToolActivity, createNormalizedCheckpoint, createResolveToolResultsEvent, createRuntimeEvent, createRuntimeInitEvent, createStartRunEvent, createStreamingEvent, createToolMessage, customAnthropicSkillSchema, deepseekProviderConfigSchema, defaultMaxRetries, defaultPerstackApiBaseUrl, defaultReasoningBudget, defaultTimeout, delegateActivitySchema, delegationCompleteActivitySchema, delegationTargetSchema, domainPatternSchema, editTextFileActivitySchema, errorActivitySchema, execActivitySchema, expertBaseSchema, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileSearchOptionsSchema, fileUrlPartSchema, finishMcpTools, finishToolCall, formatZodError, generalToolActivitySchema, getActivities, getExpertScope, getExpertShortName, getExpertType, getFilteredEnv, googleGenerativeAiProviderConfigSchema, googleProviderToolNameSchema, googleVertexProviderConfigSchema, headersSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, instructionMessageSchema, interactiveSkillSchema, interactiveToolActivitySchema, interactiveToolSchema, isCoordinatorExpert, isDelegateExpert, isPrivateOrLocalIP, isValidEventType, isValidRuntimeEventType, jobSchema, jobStatusSchema, knownModels, lockfileExpertSchema, lockfileSchema, lockfileToolDefinitionSchema, maxExpertNameLength, maxSkillNameLength, maxSkillToolNameLength, mcpSseSkillSchema, mcpStdioSkillSchema, messagePartSchema, messageSchema, ollamaProviderConfigSchema, openAiProviderConfigSchema, openaiProviderToolNameSchema, parallelActivitiesGroupSchema, parseExpertKey, parseWithFriendlyError, perstackConfigSchema, proceedToInteractiveTools, providerConfigSchema, providerNameSchema, providerTableSchema, providerToolOptionsSchema, queryActivitySchema, readImageFileActivitySchema, readPdfFileActivitySchema, readTextFileActivitySchema, reasoningBudgetSchema, removeDelegateActivitySchema, removeSkillActivitySchema, resolveToolResults, resumeFromStop, resumeToolCalls, retry, retryActivitySchema, runCommandInputSchema, runParamsSchema, runSettingSchema, runtimeVersionSchema, skillSchema, skipDelegates, startCommandInputSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByError, stopRunByInteractiveTool, tagNameRegex, textPartSchema, thinkingPartSchema, todoActivitySchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, usageSchema, userMessageSchema, validateAllDelegations, validateDelegation, validateEventFilter, vertexProviderToolNameSchema, webFetchOptionsSchema, webSearchOptionsSchema, writeTextFileActivitySchema };
2044
+ export { BASE_SKILL_PREFIX, PerstackError, SAFE_ENV_VARS, activityOrGroupSchema, activitySchema, addDelegateActivitySchema, addSkillActivitySchema, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, anthropicProviderSkillSchema, anthropicProviderToolNameSchema, attemptCompletionActivitySchema, azureOpenAIProviderToolNameSchema, azureOpenAiProviderConfigSchema, basePartSchema, builtinAnthropicSkillSchema, callTools, checkpointSchema, checkpointStatusSchema, clearTodoActivitySchema, completeActivitySchema, completeRun, continueToNextStep, createBaseToolActivity, createCallToolsEvent, createCompleteRunEvent, createEmptyUsage, createEvent, createExpertActivitySchema, createFilteredEventListener, createGeneralToolActivity, createNormalizedCheckpoint, createResolveToolResultsEvent, createRuntimeEvent, createRuntimeInitEvent, createStartRunEvent, createStreamingEvent, createToolMessage, customAnthropicSkillSchema, deepseekProviderConfigSchema, defaultMaxRetries, defaultPerstackApiBaseUrl, defaultReasoningBudget, defaultTimeout, delegateActivitySchema, delegationCompleteActivitySchema, delegationTargetSchema, domainPatternSchema, editTextFileActivitySchema, errorActivitySchema, execActivitySchema, expertBaseSchema, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileSearchOptionsSchema, fileUrlPartSchema, finishMcpTools, finishToolCall, formatZodError, generalToolActivitySchema, getActivities, getExpertScope, getExpertShortName, getExpertType, getFilteredEnv, googleGenerativeAiProviderConfigSchema, googleProviderToolNameSchema, googleVertexProviderConfigSchema, headersSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, instructionMessageSchema, interactiveSkillSchema, interactiveToolActivitySchema, interactiveToolSchema, isCoordinatorExpert, isDelegateExpert, isPrivateOrLocalIP, isValidEventType, isValidRuntimeEventType, jobSchema, jobStatusSchema, knownModels, lockfileExpertSchema, lockfileSchema, lockfileToolDefinitionSchema, maxExpertNameLength, maxSkillNameLength, maxSkillToolNameLength, mcpSseSkillSchema, mcpStdioSkillSchema, messagePartSchema, messageSchema, modelTierSchema, ollamaProviderConfigSchema, openAiProviderConfigSchema, openaiProviderToolNameSchema, parallelActivitiesGroupSchema, parseExpertKey, parseWithFriendlyError, perstackConfigSchema, proceedToInteractiveTools, providerConfigSchema, providerNameSchema, providerTableSchema, providerToolOptionsSchema, queryActivitySchema, readImageFileActivitySchema, readPdfFileActivitySchema, readTextFileActivitySchema, reasoningBudgetSchema, removeDelegateActivitySchema, removeSkillActivitySchema, resolveModelTier, resolveToolResults, resumeFromStop, resumeToolCalls, retry, retryActivitySchema, runCommandInputSchema, runParamsSchema, runSettingSchema, runtimeVersionSchema, skillSchema, skipDelegates, startCommandInputSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByError, stopRunByInteractiveTool, tagNameRegex, textPartSchema, thinkingPartSchema, todoActivitySchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, usageSchema, userMessageSchema, validateAllDelegations, validateDelegation, validateEventFilter, vertexProviderToolNameSchema, webFetchOptionsSchema, webSearchOptionsSchema, writeTextFileActivitySchema };
1983
2045
  //# sourceMappingURL=index.js.map