@perstack/core 0.0.1

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/index.js ADDED
@@ -0,0 +1,697 @@
1
+ import { z } from 'zod';
2
+ import { createId } from '@paralleldrive/cuid2';
3
+
4
+ // src/constants/constants.ts
5
+ var defaultPerstackApiBaseUrl = "https://api.perstack.ai";
6
+ var organizationNameRegex = /^[a-z0-9][a-z0-9_\.-]*$/;
7
+ var maxOrganizationNameLength = 128;
8
+ var maxApplicationNameLength = 255;
9
+ var expertKeyRegex = /^((?:@[a-z0-9][a-z0-9_\.-]*\/)?[a-z0-9][a-z0-9_\.-]*)(?:@((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?)|@([a-z0-9][a-z0-9_\.-]*))?$/;
10
+ var expertNameRegex = /^(@[a-z0-9][a-z0-9_-]*\/)?[a-z0-9][a-z0-9_-]*$/;
11
+ var expertVersionRegex = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?$/;
12
+ var tagNameRegex = /^[a-z0-9][a-z0-9_-]*$/;
13
+ var maxExpertNameLength = 255;
14
+ var maxExpertVersionTagLength = 255;
15
+ var maxExpertKeyLength = 511;
16
+ var maxExpertDescriptionLength = 1024 * 2;
17
+ var maxExpertInstructionLength = 1024 * 20;
18
+ var maxExpertSkillItems = 255;
19
+ var maxExpertDelegateItems = 255;
20
+ var maxExpertTagItems = 8;
21
+ var defaultTemperature = 0;
22
+ var defaultMaxSteps = void 0;
23
+ var defaultMaxRetries = 5;
24
+ var defaultTimeout = 5 * 1e3 * 60;
25
+ var maxExpertJobQueryLength = 1024 * 20;
26
+ var maxExpertJobFileNameLength = 1024 * 10;
27
+ var packageWithVersionRegex = /^(?:@[a-z0-9][a-z0-9_\.-]*\/)?[a-z0-9][a-z0-9_\.-]*(?:@(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?|@[a-z0-9][a-z0-9_\.-]*)?$/;
28
+ var urlSafeRegex = /^[a-z0-9][a-z0-9_-]*$/;
29
+ var maxSkillNameLength = 255;
30
+ var maxSkillDescriptionLength = 1024 * 2;
31
+ var maxSkillRuleLength = 1024 * 2;
32
+ var maxSkillPickOmitItems = 255;
33
+ var maxSkillRequiredEnvItems = 255;
34
+ var maxSkillToolNameLength = 255;
35
+ var maxSkillEndpointLength = 1024 * 2;
36
+ var maxSkillInputJsonSchemaLength = 1024 * 20;
37
+ var maxSkillToolItems = 255;
38
+ var maxCheckpointToolCallIdLength = 255;
39
+ var envNameRegex = /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;
40
+ var maxEnvNameLength = 255;
41
+ var basePartSchema = z.object({
42
+ id: z.string()
43
+ });
44
+ var textPartSchema = basePartSchema.extend({
45
+ type: z.literal("textPart"),
46
+ text: z.string()
47
+ });
48
+ var imageUrlPartSchema = basePartSchema.extend({
49
+ type: z.literal("imageUrlPart"),
50
+ url: z.url(),
51
+ mimeType: z.string()
52
+ });
53
+ var imageInlinePartSchema = basePartSchema.extend({
54
+ type: z.literal("imageInlinePart"),
55
+ encodedData: z.string(),
56
+ mimeType: z.string()
57
+ });
58
+ var imageBinaryPartSchema = basePartSchema.extend({
59
+ type: z.literal("imageBinaryPart"),
60
+ data: z.string(),
61
+ mimeType: z.string()
62
+ });
63
+ var fileUrlPartSchema = basePartSchema.extend({
64
+ type: z.literal("fileUrlPart"),
65
+ url: z.string().url(),
66
+ mimeType: z.string()
67
+ });
68
+ var fileInlinePartSchema = basePartSchema.extend({
69
+ type: z.literal("fileInlinePart"),
70
+ encodedData: z.string(),
71
+ mimeType: z.string()
72
+ });
73
+ var fileBinaryPartSchema = basePartSchema.extend({
74
+ type: z.literal("fileBinaryPart"),
75
+ data: z.string(),
76
+ mimeType: z.string()
77
+ });
78
+ var toolCallPartSchema = basePartSchema.extend({
79
+ type: z.literal("toolCallPart"),
80
+ toolCallId: z.string(),
81
+ toolName: z.string(),
82
+ args: z.unknown()
83
+ });
84
+ var toolResultPartSchema = basePartSchema.extend({
85
+ type: z.literal("toolResultPart"),
86
+ toolCallId: z.string(),
87
+ toolName: z.string(),
88
+ contents: z.array(z.union([textPartSchema, imageInlinePartSchema])),
89
+ isError: z.boolean().optional()
90
+ });
91
+ var messagePartSchema = z.discriminatedUnion("type", [
92
+ textPartSchema,
93
+ imageUrlPartSchema,
94
+ imageInlinePartSchema,
95
+ imageBinaryPartSchema,
96
+ fileUrlPartSchema,
97
+ fileInlinePartSchema,
98
+ fileBinaryPartSchema,
99
+ toolCallPartSchema,
100
+ toolResultPartSchema
101
+ ]);
102
+
103
+ // src/schemas/message.ts
104
+ var baseMessageSchema = z.object({
105
+ id: z.string()
106
+ });
107
+ var instructionMessageSchema = baseMessageSchema.extend({
108
+ type: z.literal("instructionMessage"),
109
+ contents: z.array(textPartSchema),
110
+ cache: z.boolean().optional()
111
+ });
112
+ var userMessageSchema = baseMessageSchema.extend({
113
+ type: z.literal("userMessage"),
114
+ contents: z.array(
115
+ z.union([
116
+ textPartSchema,
117
+ imageUrlPartSchema,
118
+ imageInlinePartSchema,
119
+ imageBinaryPartSchema,
120
+ fileUrlPartSchema,
121
+ fileInlinePartSchema,
122
+ fileBinaryPartSchema
123
+ ])
124
+ ),
125
+ cache: z.boolean().optional()
126
+ });
127
+ var expertMessageSchema = baseMessageSchema.extend({
128
+ type: z.literal("expertMessage"),
129
+ contents: z.array(z.union([textPartSchema, toolCallPartSchema])),
130
+ cache: z.boolean().optional()
131
+ });
132
+ var toolMessageSchema = baseMessageSchema.extend({
133
+ type: z.literal("toolMessage"),
134
+ contents: z.array(toolResultPartSchema),
135
+ cache: z.boolean().optional()
136
+ });
137
+ var messageSchema = z.union([
138
+ instructionMessageSchema,
139
+ userMessageSchema,
140
+ expertMessageSchema,
141
+ toolMessageSchema
142
+ ]);
143
+ var usageSchema = z.object({
144
+ inputTokens: z.number(),
145
+ outputTokens: z.number(),
146
+ reasoningTokens: z.number(),
147
+ totalTokens: z.number(),
148
+ cachedInputTokens: z.number()
149
+ });
150
+
151
+ // src/schemas/checkpoint.ts
152
+ var checkpointStatusSchema = z.enum([
153
+ "init",
154
+ "proceeding",
155
+ "completed",
156
+ "stoppedByInteractiveTool",
157
+ "stoppedByDelegate",
158
+ "stoppedByExceededMaxSteps",
159
+ "stoppedByError"
160
+ ]);
161
+ var checkpointSchema = z.object({
162
+ id: z.string(),
163
+ runId: z.string(),
164
+ status: checkpointStatusSchema,
165
+ stepNumber: z.number(),
166
+ messages: z.array(messageSchema),
167
+ expert: z.object({
168
+ key: z.string(),
169
+ name: z.string(),
170
+ version: z.string()
171
+ }),
172
+ delegateTo: z.object({
173
+ expert: z.object({
174
+ key: z.string(),
175
+ name: z.string(),
176
+ version: z.string()
177
+ }),
178
+ toolCallId: z.string(),
179
+ toolName: z.string(),
180
+ query: z.string()
181
+ }).optional(),
182
+ delegatedBy: z.object({
183
+ expert: z.object({
184
+ key: z.string(),
185
+ name: z.string(),
186
+ version: z.string()
187
+ }),
188
+ toolCallId: z.string(),
189
+ toolName: z.string(),
190
+ checkpointId: z.string()
191
+ }).optional(),
192
+ usage: usageSchema,
193
+ contextWindow: z.number().optional(),
194
+ contextWindowUsage: z.number().optional()
195
+ });
196
+ var mcpStdioSkillSchema = z.object({
197
+ type: z.literal("mcpStdioSkill"),
198
+ name: z.string(),
199
+ description: z.string().optional(),
200
+ rule: z.string().optional(),
201
+ pick: z.array(z.string()).optional().default([]),
202
+ omit: z.array(z.string()).optional().default([]),
203
+ command: z.string(),
204
+ packageName: z.string().optional(),
205
+ args: z.array(z.string()).optional().default([]),
206
+ requiredEnv: z.array(z.string()).optional().default([])
207
+ });
208
+ var mcpSseSkillSchema = z.object({
209
+ type: z.literal("mcpSseSkill"),
210
+ name: z.string(),
211
+ description: z.string().optional(),
212
+ rule: z.string().optional(),
213
+ pick: z.array(z.string()).optional().default([]),
214
+ omit: z.array(z.string()).optional().default([]),
215
+ endpoint: z.string()
216
+ });
217
+ var interactiveToolSchema = z.object({
218
+ name: z.string(),
219
+ description: z.string().optional(),
220
+ inputJsonSchema: z.string()
221
+ });
222
+ var interactiveSkillSchema = z.object({
223
+ type: z.literal("interactiveSkill"),
224
+ name: z.string(),
225
+ description: z.string().optional(),
226
+ rule: z.string().optional(),
227
+ tools: z.record(z.string(), interactiveToolSchema.omit({ name: true })).transform((tools) => {
228
+ return Object.fromEntries(
229
+ Object.entries(tools).map(([key, toolWithoutName]) => [
230
+ key,
231
+ interactiveToolSchema.parse({ ...toolWithoutName, name: key })
232
+ ])
233
+ );
234
+ })
235
+ });
236
+ var skillSchema = z.discriminatedUnion("type", [
237
+ mcpStdioSkillSchema,
238
+ mcpSseSkillSchema,
239
+ interactiveSkillSchema
240
+ ]);
241
+
242
+ // src/schemas/expert.ts
243
+ var expertSchema = z.object({
244
+ key: z.string().regex(expertKeyRegex).min(1),
245
+ name: z.string().regex(expertNameRegex).min(1).max(maxExpertNameLength),
246
+ version: z.string().regex(expertVersionRegex),
247
+ description: z.string().min(1).max(1024 * 2).optional(),
248
+ instruction: z.string().min(1).max(1024 * 20),
249
+ skills: z.record(
250
+ z.string(),
251
+ z.discriminatedUnion("type", [
252
+ mcpStdioSkillSchema.omit({ name: true }),
253
+ mcpSseSkillSchema.omit({ name: true }),
254
+ interactiveSkillSchema.omit({ name: true })
255
+ ])
256
+ ).optional().default({
257
+ "@perstack/base": {
258
+ type: "mcpStdioSkill",
259
+ description: "Base skill",
260
+ command: "npx",
261
+ args: ["-y", "@perstack/base"],
262
+ pick: [],
263
+ omit: [],
264
+ requiredEnv: []
265
+ }
266
+ }).transform((skills) => {
267
+ return Object.fromEntries(
268
+ Object.entries(skills).map(([key, skillWithoutName]) => [
269
+ key,
270
+ z.discriminatedUnion("type", [
271
+ mcpStdioSkillSchema,
272
+ mcpSseSkillSchema,
273
+ interactiveSkillSchema
274
+ ]).parse({ ...skillWithoutName, name: key })
275
+ ])
276
+ );
277
+ }),
278
+ delegates: z.array(z.string().regex(expertKeyRegex).min(1)).optional().default([]),
279
+ tags: z.array(z.string().regex(tagNameRegex).min(1)).optional().default([])
280
+ });
281
+ var providerNameSchema = z.enum([
282
+ "anthropic",
283
+ "google",
284
+ "openai",
285
+ "ollama",
286
+ "azure-openai",
287
+ "amazon-bedrock"
288
+ ]);
289
+ var anthropicProviderConfigSchema = z.object({
290
+ name: z.literal(providerNameSchema.enum.anthropic),
291
+ apiKey: z.string(),
292
+ baseUrl: z.string().optional()
293
+ });
294
+ var googleGenerativeAiProviderConfigSchema = z.object({
295
+ name: z.literal(providerNameSchema.enum.google),
296
+ apiKey: z.string(),
297
+ baseUrl: z.string().optional()
298
+ });
299
+ var openAiProviderConfigSchema = z.object({
300
+ name: z.literal(providerNameSchema.enum.openai),
301
+ apiKey: z.string(),
302
+ baseUrl: z.string().optional(),
303
+ organization: z.string().optional(),
304
+ project: z.string().optional()
305
+ });
306
+ var ollamaProviderConfigSchema = z.object({
307
+ name: z.literal(providerNameSchema.enum.ollama),
308
+ baseUrl: z.string().optional()
309
+ });
310
+ var azureOpenAiProviderConfigSchema = z.object({
311
+ name: z.literal(providerNameSchema.enum["azure-openai"]),
312
+ apiKey: z.string(),
313
+ resourceName: z.string(),
314
+ apiVersion: z.string().optional()
315
+ });
316
+ var amazonBedrockProviderConfigSchema = z.object({
317
+ name: z.literal(providerNameSchema.enum["amazon-bedrock"]),
318
+ accessKeyId: z.string(),
319
+ secretAccessKey: z.string(),
320
+ region: z.string(),
321
+ sessionToken: z.string().optional()
322
+ });
323
+ var providerConfigSchema = z.discriminatedUnion("name", [
324
+ anthropicProviderConfigSchema,
325
+ googleGenerativeAiProviderConfigSchema,
326
+ openAiProviderConfigSchema,
327
+ ollamaProviderConfigSchema,
328
+ azureOpenAiProviderConfigSchema,
329
+ amazonBedrockProviderConfigSchema
330
+ ]);
331
+
332
+ // src/schemas/perstack-toml.ts
333
+ var perstackConfigSchema = z.object({
334
+ provider: providerNameSchema.optional(),
335
+ model: z.string().optional(),
336
+ temperature: z.number().optional(),
337
+ maxSteps: z.number().optional(),
338
+ maxRetries: z.number().optional(),
339
+ timeout: z.number().optional(),
340
+ experts: z.record(
341
+ z.string(),
342
+ z.object({
343
+ version: z.string().optional(),
344
+ minRuntimeVersion: z.string().optional(),
345
+ description: z.string().optional(),
346
+ instruction: z.string(),
347
+ skills: z.record(
348
+ z.string(),
349
+ z.discriminatedUnion("type", [
350
+ z.object({
351
+ type: z.literal("mcpStdioSkill"),
352
+ description: z.string().optional(),
353
+ rule: z.string().optional(),
354
+ pick: z.array(z.string()).optional(),
355
+ omit: z.array(z.string()).optional(),
356
+ command: z.string(),
357
+ packageName: z.string().optional(),
358
+ args: z.array(z.string()).optional(),
359
+ requiredEnv: z.array(z.string()).optional()
360
+ }),
361
+ z.object({
362
+ type: z.literal("mcpSseSkill"),
363
+ description: z.string().optional(),
364
+ rule: z.string().optional(),
365
+ pick: z.array(z.string()).optional(),
366
+ omit: z.array(z.string()).optional(),
367
+ endpoint: z.string()
368
+ }),
369
+ z.object({
370
+ type: z.literal("interactiveSkill"),
371
+ description: z.string().optional(),
372
+ rule: z.string().optional(),
373
+ tools: z.record(
374
+ z.string(),
375
+ z.object({
376
+ description: z.string().optional(),
377
+ inputJsonSchema: z.string()
378
+ })
379
+ )
380
+ })
381
+ ])
382
+ ).optional(),
383
+ delegates: z.array(z.string()).optional()
384
+ })
385
+ ).optional(),
386
+ perstackApiBaseUrl: z.url().optional(),
387
+ perstackBaseSkillArgs: z.array(z.string()).optional(),
388
+ envPath: z.array(z.string()).optional()
389
+ });
390
+ var runCommandInputSchema = z.object({
391
+ expertKey: z.string(),
392
+ query: z.string(),
393
+ options: z.object({
394
+ config: z.string().optional(),
395
+ provider: providerNameSchema.optional(),
396
+ model: z.string().optional(),
397
+ temperature: z.string().optional().transform((value) => {
398
+ if (value === void 0) {
399
+ return void 0;
400
+ }
401
+ const parsedValue = Number.parseFloat(value);
402
+ if (Number.isNaN(parsedValue)) {
403
+ return void 0;
404
+ }
405
+ return parsedValue;
406
+ }),
407
+ maxSteps: z.string().optional().transform((value) => {
408
+ if (value === void 0) {
409
+ return void 0;
410
+ }
411
+ const parsedValue = Number.parseInt(value);
412
+ if (Number.isNaN(parsedValue)) {
413
+ return void 0;
414
+ }
415
+ return parsedValue;
416
+ }),
417
+ maxRetries: z.string().optional().transform((value) => {
418
+ if (value === void 0) {
419
+ return void 0;
420
+ }
421
+ const parsedValue = Number.parseInt(value);
422
+ if (Number.isNaN(parsedValue)) {
423
+ return void 0;
424
+ }
425
+ return parsedValue;
426
+ }),
427
+ timeout: z.string().optional().transform((value) => {
428
+ if (value === void 0) {
429
+ return void 0;
430
+ }
431
+ const parsedValue = Number.parseInt(value);
432
+ if (Number.isNaN(parsedValue)) {
433
+ return void 0;
434
+ }
435
+ return parsedValue;
436
+ }),
437
+ runId: z.string().optional(),
438
+ envPath: z.array(z.string()).optional()
439
+ })
440
+ });
441
+ function parseExpertKey(expertKey) {
442
+ const match = expertKey.match(expertKeyRegex);
443
+ if (!match) {
444
+ throw new Error(`Invalid expert key format: ${expertKey}`);
445
+ }
446
+ const [key, name, version, tag] = match;
447
+ return {
448
+ key,
449
+ name,
450
+ version,
451
+ tag
452
+ };
453
+ }
454
+ var runParamsSchema = z.object({
455
+ setting: z.object({
456
+ model: z.string(),
457
+ providerConfig: providerConfigSchema,
458
+ runId: z.string().optional().default(createId()),
459
+ expertKey: z.string().min(1).regex(expertKeyRegex),
460
+ input: z.object({
461
+ text: z.string().optional(),
462
+ interactiveToolCallResult: z.object({
463
+ toolCallId: z.string(),
464
+ toolName: z.string(),
465
+ text: z.string()
466
+ }).optional()
467
+ }),
468
+ experts: z.record(z.string().min(1).regex(expertKeyRegex), expertSchema.omit({ key: true })).optional().default({}).transform(
469
+ (experts) => Object.fromEntries(
470
+ Object.entries(experts).map(([key, expertWithoutKey]) => [
471
+ key,
472
+ expertSchema.parse({
473
+ ...expertWithoutKey,
474
+ key
475
+ })
476
+ ])
477
+ )
478
+ ),
479
+ temperature: z.number().min(0).max(1).optional().default(defaultTemperature),
480
+ maxSteps: z.number().min(1).optional(),
481
+ maxRetries: z.number().min(0).optional().default(defaultMaxRetries),
482
+ timeout: z.number().min(0).optional().default(defaultTimeout),
483
+ workspace: z.string().optional(),
484
+ startedAt: z.number().optional().default(Date.now()),
485
+ updatedAt: z.number().optional().default(Date.now()),
486
+ perstackApiBaseUrl: z.url().optional().default(defaultPerstackApiBaseUrl),
487
+ perstackApiKey: z.string().optional(),
488
+ perstackBaseSkillArgs: z.array(z.string()).optional(),
489
+ env: z.record(z.string(), z.string()).optional().default({})
490
+ }),
491
+ checkpoint: checkpointSchema.optional()
492
+ });
493
+ function createEvent(type) {
494
+ return (setting, checkpoint, data) => {
495
+ return {
496
+ type,
497
+ id: createId(),
498
+ expertKey: checkpoint.expert.key,
499
+ timestamp: Date.now(),
500
+ runId: setting.runId,
501
+ stepNumber: checkpoint.stepNumber,
502
+ ...data
503
+ };
504
+ };
505
+ }
506
+ var startRun = createEvent("startRun");
507
+ var startGeneration = createEvent("startGeneration");
508
+ var retry = createEvent("retry");
509
+ var callTool = createEvent("callTool");
510
+ var callInteractiveTool = createEvent("callInteractiveTool");
511
+ var callDelegate = createEvent("callDelegate");
512
+ var resolveToolResult = createEvent("resolveToolResult");
513
+ var resolveThought = createEvent("resolveThought");
514
+ var resolvePdfFile = createEvent("resolvePdfFile");
515
+ var resolveImageFile = createEvent("resolveImageFile");
516
+ var attemptCompletion = createEvent("attemptCompletion");
517
+ var finishToolCall = createEvent("finishToolCall");
518
+ var completeRun = createEvent("completeRun");
519
+ var stopRunByInteractiveTool = createEvent("stopRunByInteractiveTool");
520
+ var stopRunByDelegate = createEvent("stopRunByDelegate");
521
+ var stopRunByExceededMaxSteps = createEvent("stopRunByExceededMaxSteps");
522
+ var continueToNextStep = createEvent("continueToNextStep");
523
+ var toolCallSchema = z.object({
524
+ id: z.string().min(1).max(255),
525
+ skillName: z.string().min(1).max(maxSkillNameLength),
526
+ toolName: z.string().min(1).max(maxSkillToolNameLength),
527
+ args: z.record(z.string().min(1), z.unknown())
528
+ });
529
+ var toolResultSchema = z.object({
530
+ id: z.string().min(1).max(255),
531
+ skillName: z.string().min(1).max(maxSkillNameLength),
532
+ toolName: z.string().min(1).max(maxSkillToolNameLength),
533
+ result: z.array(messagePartSchema)
534
+ });
535
+
536
+ // src/schemas/step.ts
537
+ var stepSchema = z.object({
538
+ stepNumber: z.number(),
539
+ inputMessages: z.array(z.union([instructionMessageSchema, userMessageSchema, toolMessageSchema])).optional(),
540
+ newMessages: z.array(messageSchema),
541
+ toolCall: toolCallSchema.optional(),
542
+ toolResult: toolResultSchema.optional(),
543
+ usage: usageSchema,
544
+ startedAt: z.number(),
545
+ finishedAt: z.number().optional()
546
+ });
547
+
548
+ // src/known-models/index.ts
549
+ var knownModels = [
550
+ {
551
+ provider: "anthropic",
552
+ models: [
553
+ // https://docs.claude.com/en/docs/about-claude/models/overview#model-comparison-table
554
+ {
555
+ name: "claude-opus-4-20250514",
556
+ contextWindow: 2e5,
557
+ maxOutputTokens: 32e3
558
+ },
559
+ {
560
+ name: "claude-sonnet-4-20250514",
561
+ contextWindow: 2e5,
562
+ maxOutputTokens: 64e3
563
+ },
564
+ {
565
+ name: "claude-3-7-sonnet-20250219",
566
+ contextWindow: 2e5,
567
+ maxOutputTokens: 64e3
568
+ },
569
+ {
570
+ name: "claude-3-5-haiku-latest",
571
+ contextWindow: 2e5,
572
+ maxOutputTokens: 8192
573
+ }
574
+ ]
575
+ },
576
+ {
577
+ provider: "google",
578
+ models: [
579
+ // https://ai.google.dev/gemini-api/docs/models#gemini-2.5-pro
580
+ {
581
+ name: "gemini-2.5-pro",
582
+ contextWindow: 1048576,
583
+ maxOutputTokens: 65536
584
+ },
585
+ // https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash
586
+ {
587
+ name: "gemini-2.5-flash",
588
+ contextWindow: 1048576,
589
+ maxOutputTokens: 65536
590
+ },
591
+ // https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-lite
592
+ {
593
+ name: "gemini-2.5-flash-lite",
594
+ contextWindow: 1048576,
595
+ maxOutputTokens: 65536
596
+ }
597
+ ]
598
+ },
599
+ {
600
+ provider: "openai",
601
+ models: [
602
+ // https://platform.openai.com/docs/models/gpt-5
603
+ {
604
+ name: "gpt-5",
605
+ contextWindow: 4e5,
606
+ maxOutputTokens: 128e3
607
+ },
608
+ // https://platform.openai.com/docs/models/gpt-5-mini
609
+ {
610
+ name: "gpt-5-mini",
611
+ contextWindow: 4e5,
612
+ maxOutputTokens: 128e3
613
+ },
614
+ // https://platform.openai.com/docs/models/gpt-5-nano
615
+ {
616
+ name: "gpt-5-nano",
617
+ contextWindow: 4e5,
618
+ maxOutputTokens: 128e3
619
+ },
620
+ // https://platform.openai.com/docs/models/gpt-5-chat-latest
621
+ {
622
+ name: "gpt-5-chat-latest",
623
+ contextWindow: 128e3,
624
+ maxOutputTokens: 16384
625
+ },
626
+ // https://platform.openai.com/docs/models/o4-mini
627
+ {
628
+ name: "o4-mini",
629
+ contextWindow: 2e5,
630
+ maxOutputTokens: 1e5
631
+ },
632
+ // https://platform.openai.com/docs/models/o3
633
+ {
634
+ name: "o3",
635
+ contextWindow: 2e5,
636
+ maxOutputTokens: 1e4
637
+ },
638
+ // https://platform.openai.com/docs/models/o3-mini
639
+ {
640
+ name: "o3-mini",
641
+ contextWindow: 2e5,
642
+ maxOutputTokens: 1e4
643
+ },
644
+ // https://platform.openai.com/docs/models/gpt-4.1
645
+ {
646
+ name: "gpt-4.1",
647
+ contextWindow: 1047576,
648
+ maxOutputTokens: 32768
649
+ }
650
+ ]
651
+ },
652
+ {
653
+ provider: "ollama",
654
+ models: [
655
+ // https://platform.openai.com/docs/models/gpt-oss-20b
656
+ {
657
+ name: "gpt-oss:20b",
658
+ contextWindow: 131072,
659
+ maxOutputTokens: 131072
660
+ },
661
+ // https://platform.openai.com/docs/models/gpt-oss-120b
662
+ {
663
+ name: "gpt-oss:120b",
664
+ contextWindow: 131072,
665
+ maxOutputTokens: 131072
666
+ },
667
+ // https://ai.google.dev/gemma/docs/core/model_card_3
668
+ {
669
+ name: "gemma3:1b",
670
+ contextWindow: 32e3,
671
+ maxOutputTokens: 32e3
672
+ },
673
+ // https://ai.google.dev/gemma/docs/core/model_card_3
674
+ {
675
+ name: "gemma3:4b",
676
+ contextWindow: 128e3,
677
+ maxOutputTokens: 128e3
678
+ },
679
+ // https://ai.google.dev/gemma/docs/core/model_card_3
680
+ {
681
+ name: "gemma3:12b",
682
+ contextWindow: 128e3,
683
+ maxOutputTokens: 128e3
684
+ },
685
+ // https://ai.google.dev/gemma/docs/core/model_card_3
686
+ {
687
+ name: "gemma3:27b",
688
+ contextWindow: 128e3,
689
+ maxOutputTokens: 128e3
690
+ }
691
+ ]
692
+ }
693
+ ];
694
+
695
+ export { amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, attemptCompletion, azureOpenAiProviderConfigSchema, basePartSchema, callDelegate, callInteractiveTool, callTool, checkpointSchema, checkpointStatusSchema, completeRun, continueToNextStep, createEvent, defaultMaxRetries, defaultMaxSteps, defaultPerstackApiBaseUrl, defaultTemperature, defaultTimeout, envNameRegex, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileUrlPartSchema, finishToolCall, googleGenerativeAiProviderConfigSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, instructionMessageSchema, interactiveSkillSchema, interactiveToolSchema, knownModels, maxApplicationNameLength, maxCheckpointToolCallIdLength, maxEnvNameLength, maxExpertDelegateItems, maxExpertDescriptionLength, maxExpertInstructionLength, maxExpertJobFileNameLength, maxExpertJobQueryLength, maxExpertKeyLength, maxExpertNameLength, maxExpertSkillItems, maxExpertTagItems, maxExpertVersionTagLength, maxOrganizationNameLength, maxSkillDescriptionLength, maxSkillEndpointLength, maxSkillInputJsonSchemaLength, maxSkillNameLength, maxSkillPickOmitItems, maxSkillRequiredEnvItems, maxSkillRuleLength, maxSkillToolItems, maxSkillToolNameLength, mcpSseSkillSchema, mcpStdioSkillSchema, messagePartSchema, messageSchema, ollamaProviderConfigSchema, openAiProviderConfigSchema, organizationNameRegex, packageWithVersionRegex, parseExpertKey, perstackConfigSchema, providerConfigSchema, providerNameSchema, resolveImageFile, resolvePdfFile, resolveThought, resolveToolResult, retry, runCommandInputSchema, runParamsSchema, skillSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, textPartSchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, urlSafeRegex, usageSchema, userMessageSchema };
696
+ //# sourceMappingURL=index.js.map
697
+ //# sourceMappingURL=index.js.map