@perstack/core 0.0.15 → 0.0.17

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.
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import { z, ZodError, ZodSchema } from 'zod';
2
2
 
3
3
  declare const defaultPerstackApiBaseUrl = "https://api.perstack.ai";
4
4
  declare const organizationNameRegex: RegExp;
@@ -37,6 +37,460 @@ declare const maxCheckpointToolCallIdLength = 255;
37
37
  declare const envNameRegex: RegExp;
38
38
  declare const maxEnvNameLength = 255;
39
39
 
40
+ declare const knownModels: {
41
+ provider: string;
42
+ models: {
43
+ name: string;
44
+ contextWindow: number;
45
+ maxOutputTokens: number;
46
+ }[];
47
+ }[];
48
+
49
+ /** Base properties shared by all message parts */
50
+ interface BasePart {
51
+ /** Unique identifier for this part */
52
+ id: string;
53
+ }
54
+ declare const basePartSchema: z.ZodObject<{
55
+ id: z.ZodString;
56
+ }, z.core.$strip>;
57
+ /** Plain text content */
58
+ interface TextPart extends BasePart {
59
+ type: "textPart";
60
+ /** The text content */
61
+ text: string;
62
+ }
63
+ declare const textPartSchema: z.ZodObject<{
64
+ id: z.ZodString;
65
+ type: z.ZodLiteral<"textPart">;
66
+ text: z.ZodString;
67
+ }, z.core.$strip>;
68
+ /** Image referenced by URL */
69
+ interface ImageUrlPart extends BasePart {
70
+ type: "imageUrlPart";
71
+ /** URL to the image */
72
+ url: string;
73
+ /** MIME type of the image */
74
+ mimeType: string;
75
+ }
76
+ declare const imageUrlPartSchema: z.ZodObject<{
77
+ id: z.ZodString;
78
+ type: z.ZodLiteral<"imageUrlPart">;
79
+ url: z.ZodURL;
80
+ mimeType: z.ZodString;
81
+ }, z.core.$strip>;
82
+ /** Image with base64-encoded inline data */
83
+ interface ImageInlinePart extends BasePart {
84
+ type: "imageInlinePart";
85
+ /** Base64-encoded image data */
86
+ encodedData: string;
87
+ /** MIME type of the image */
88
+ mimeType: string;
89
+ }
90
+ declare const imageInlinePartSchema: z.ZodObject<{
91
+ id: z.ZodString;
92
+ type: z.ZodLiteral<"imageInlinePart">;
93
+ encodedData: z.ZodString;
94
+ mimeType: z.ZodString;
95
+ }, z.core.$strip>;
96
+ /** Image with binary data (internal use) */
97
+ interface ImageBinaryPart extends BasePart {
98
+ type: "imageBinaryPart";
99
+ /** Binary data as string */
100
+ data: string;
101
+ /** MIME type of the image */
102
+ mimeType: string;
103
+ }
104
+ declare const imageBinaryPartSchema: z.ZodObject<{
105
+ id: z.ZodString;
106
+ type: z.ZodLiteral<"imageBinaryPart">;
107
+ data: z.ZodString;
108
+ mimeType: z.ZodString;
109
+ }, z.core.$strip>;
110
+ /** File referenced by URL */
111
+ interface FileUrlPart extends BasePart {
112
+ type: "fileUrlPart";
113
+ /** URL to the file */
114
+ url: string;
115
+ /** MIME type of the file */
116
+ mimeType: string;
117
+ }
118
+ declare const fileUrlPartSchema: z.ZodObject<{
119
+ id: z.ZodString;
120
+ type: z.ZodLiteral<"fileUrlPart">;
121
+ url: z.ZodString;
122
+ mimeType: z.ZodString;
123
+ }, z.core.$strip>;
124
+ /** File with base64-encoded inline data */
125
+ interface FileInlinePart extends BasePart {
126
+ type: "fileInlinePart";
127
+ /** Base64-encoded file data */
128
+ encodedData: string;
129
+ /** MIME type of the file */
130
+ mimeType: string;
131
+ }
132
+ declare const fileInlinePartSchema: z.ZodObject<{
133
+ id: z.ZodString;
134
+ type: z.ZodLiteral<"fileInlinePart">;
135
+ encodedData: z.ZodString;
136
+ mimeType: z.ZodString;
137
+ }, z.core.$strip>;
138
+ /** File with binary data (internal use) */
139
+ interface FileBinaryPart extends BasePart {
140
+ type: "fileBinaryPart";
141
+ /** Binary data as string */
142
+ data: string;
143
+ /** MIME type of the file */
144
+ mimeType: string;
145
+ }
146
+ declare const fileBinaryPartSchema: z.ZodObject<{
147
+ id: z.ZodString;
148
+ type: z.ZodLiteral<"fileBinaryPart">;
149
+ data: z.ZodString;
150
+ mimeType: z.ZodString;
151
+ }, z.core.$strip>;
152
+ /** A tool call request from the Expert */
153
+ interface ToolCallPart extends BasePart {
154
+ type: "toolCallPart";
155
+ /** Unique identifier for this tool call */
156
+ toolCallId: string;
157
+ /** Name of the tool to call */
158
+ toolName: string;
159
+ /** Arguments to pass to the tool */
160
+ args: unknown;
161
+ }
162
+ declare const toolCallPartSchema: z.ZodObject<{
163
+ id: z.ZodString;
164
+ type: z.ZodLiteral<"toolCallPart">;
165
+ toolCallId: z.ZodString;
166
+ toolName: z.ZodString;
167
+ args: z.ZodUnknown;
168
+ }, z.core.$strip>;
169
+ /** Result of a tool call */
170
+ interface ToolResultPart extends BasePart {
171
+ type: "toolResultPart";
172
+ /** ID of the tool call this result corresponds to */
173
+ toolCallId: string;
174
+ /** Name of the tool that was called */
175
+ toolName: string;
176
+ /** Content of the tool result */
177
+ contents: (TextPart | ImageInlinePart)[];
178
+ /** Whether the tool call resulted in an error */
179
+ isError?: boolean;
180
+ }
181
+ declare const toolResultPartSchema: z.ZodObject<{
182
+ id: z.ZodString;
183
+ type: z.ZodLiteral<"toolResultPart">;
184
+ toolCallId: z.ZodString;
185
+ toolName: z.ZodString;
186
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
187
+ id: z.ZodString;
188
+ type: z.ZodLiteral<"textPart">;
189
+ text: z.ZodString;
190
+ }, z.core.$strip>, z.ZodObject<{
191
+ id: z.ZodString;
192
+ type: z.ZodLiteral<"imageInlinePart">;
193
+ encodedData: z.ZodString;
194
+ mimeType: z.ZodString;
195
+ }, z.core.$strip>]>>;
196
+ isError: z.ZodOptional<z.ZodBoolean>;
197
+ }, z.core.$strip>;
198
+ /** All possible message part types */
199
+ type MessagePart = TextPart | ImageUrlPart | ImageInlinePart | ImageBinaryPart | FileUrlPart | FileInlinePart | FileBinaryPart | ToolCallPart | ToolResultPart;
200
+ declare const messagePartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
201
+ id: z.ZodString;
202
+ type: z.ZodLiteral<"textPart">;
203
+ text: z.ZodString;
204
+ }, z.core.$strip>, z.ZodObject<{
205
+ id: z.ZodString;
206
+ type: z.ZodLiteral<"imageUrlPart">;
207
+ url: z.ZodURL;
208
+ mimeType: z.ZodString;
209
+ }, z.core.$strip>, z.ZodObject<{
210
+ id: z.ZodString;
211
+ type: z.ZodLiteral<"imageInlinePart">;
212
+ encodedData: z.ZodString;
213
+ mimeType: z.ZodString;
214
+ }, z.core.$strip>, z.ZodObject<{
215
+ id: z.ZodString;
216
+ type: z.ZodLiteral<"imageBinaryPart">;
217
+ data: z.ZodString;
218
+ mimeType: z.ZodString;
219
+ }, z.core.$strip>, z.ZodObject<{
220
+ id: z.ZodString;
221
+ type: z.ZodLiteral<"fileUrlPart">;
222
+ url: z.ZodString;
223
+ mimeType: z.ZodString;
224
+ }, z.core.$strip>, z.ZodObject<{
225
+ id: z.ZodString;
226
+ type: z.ZodLiteral<"fileInlinePart">;
227
+ encodedData: z.ZodString;
228
+ mimeType: z.ZodString;
229
+ }, z.core.$strip>, z.ZodObject<{
230
+ id: z.ZodString;
231
+ type: z.ZodLiteral<"fileBinaryPart">;
232
+ data: z.ZodString;
233
+ mimeType: z.ZodString;
234
+ }, z.core.$strip>, z.ZodObject<{
235
+ id: z.ZodString;
236
+ type: z.ZodLiteral<"toolCallPart">;
237
+ toolCallId: z.ZodString;
238
+ toolName: z.ZodString;
239
+ args: z.ZodUnknown;
240
+ }, z.core.$strip>, z.ZodObject<{
241
+ id: z.ZodString;
242
+ type: z.ZodLiteral<"toolResultPart">;
243
+ toolCallId: z.ZodString;
244
+ toolName: z.ZodString;
245
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
246
+ id: z.ZodString;
247
+ type: z.ZodLiteral<"textPart">;
248
+ text: z.ZodString;
249
+ }, z.core.$strip>, z.ZodObject<{
250
+ id: z.ZodString;
251
+ type: z.ZodLiteral<"imageInlinePart">;
252
+ encodedData: z.ZodString;
253
+ mimeType: z.ZodString;
254
+ }, z.core.$strip>]>>;
255
+ isError: z.ZodOptional<z.ZodBoolean>;
256
+ }, z.core.$strip>], "type">;
257
+
258
+ /** Base properties shared by all messages */
259
+ interface BaseMessage {
260
+ /** Unique identifier for this message */
261
+ id: string;
262
+ }
263
+ /** System instruction message sent at the start of a conversation */
264
+ interface InstructionMessage extends BaseMessage {
265
+ type: "instructionMessage";
266
+ /** Text content of the instruction */
267
+ contents: TextPart[];
268
+ /** Whether to cache this message for prompt caching */
269
+ cache?: boolean;
270
+ }
271
+ declare const instructionMessageSchema: z.ZodObject<{
272
+ id: z.ZodString;
273
+ type: z.ZodLiteral<"instructionMessage">;
274
+ contents: z.ZodArray<z.ZodObject<{
275
+ id: z.ZodString;
276
+ type: z.ZodLiteral<"textPart">;
277
+ text: z.ZodString;
278
+ }, z.core.$strip>>;
279
+ cache: z.ZodOptional<z.ZodBoolean>;
280
+ }, z.core.$strip>;
281
+ /** Message from the user (human or system providing input) */
282
+ interface UserMessage extends BaseMessage {
283
+ type: "userMessage";
284
+ /** Content of the user message (text, images, or files) */
285
+ contents: (TextPart | ImageUrlPart | ImageInlinePart | ImageBinaryPart | FileUrlPart | FileInlinePart | FileBinaryPart)[];
286
+ /** Whether to cache this message for prompt caching */
287
+ cache?: boolean;
288
+ }
289
+ declare const userMessageSchema: z.ZodObject<{
290
+ id: z.ZodString;
291
+ type: z.ZodLiteral<"userMessage">;
292
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
293
+ id: z.ZodString;
294
+ type: z.ZodLiteral<"textPart">;
295
+ text: z.ZodString;
296
+ }, z.core.$strip>, z.ZodObject<{
297
+ id: z.ZodString;
298
+ type: z.ZodLiteral<"imageUrlPart">;
299
+ url: z.ZodURL;
300
+ mimeType: z.ZodString;
301
+ }, z.core.$strip>, z.ZodObject<{
302
+ id: z.ZodString;
303
+ type: z.ZodLiteral<"imageInlinePart">;
304
+ encodedData: z.ZodString;
305
+ mimeType: z.ZodString;
306
+ }, z.core.$strip>, z.ZodObject<{
307
+ id: z.ZodString;
308
+ type: z.ZodLiteral<"imageBinaryPart">;
309
+ data: z.ZodString;
310
+ mimeType: z.ZodString;
311
+ }, z.core.$strip>, z.ZodObject<{
312
+ id: z.ZodString;
313
+ type: z.ZodLiteral<"fileUrlPart">;
314
+ url: z.ZodString;
315
+ mimeType: z.ZodString;
316
+ }, z.core.$strip>, z.ZodObject<{
317
+ id: z.ZodString;
318
+ type: z.ZodLiteral<"fileInlinePart">;
319
+ encodedData: z.ZodString;
320
+ mimeType: z.ZodString;
321
+ }, z.core.$strip>, z.ZodObject<{
322
+ id: z.ZodString;
323
+ type: z.ZodLiteral<"fileBinaryPart">;
324
+ data: z.ZodString;
325
+ mimeType: z.ZodString;
326
+ }, z.core.$strip>]>>;
327
+ cache: z.ZodOptional<z.ZodBoolean>;
328
+ }, z.core.$strip>;
329
+ /** Message generated by the Expert (LLM response) */
330
+ interface ExpertMessage extends BaseMessage {
331
+ type: "expertMessage";
332
+ /** Content generated by the Expert (text or tool calls) */
333
+ contents: (TextPart | ToolCallPart)[];
334
+ /** Whether to cache this message for prompt caching */
335
+ cache?: boolean;
336
+ }
337
+ declare const expertMessageSchema: z.ZodObject<{
338
+ id: z.ZodString;
339
+ type: z.ZodLiteral<"expertMessage">;
340
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
341
+ id: z.ZodString;
342
+ type: z.ZodLiteral<"textPart">;
343
+ text: z.ZodString;
344
+ }, z.core.$strip>, z.ZodObject<{
345
+ id: z.ZodString;
346
+ type: z.ZodLiteral<"toolCallPart">;
347
+ toolCallId: z.ZodString;
348
+ toolName: z.ZodString;
349
+ args: z.ZodUnknown;
350
+ }, z.core.$strip>]>>;
351
+ cache: z.ZodOptional<z.ZodBoolean>;
352
+ }, z.core.$strip>;
353
+ /** Message containing tool execution results */
354
+ interface ToolMessage extends BaseMessage {
355
+ type: "toolMessage";
356
+ /** Tool result contents */
357
+ contents: ToolResultPart[];
358
+ /** Whether to cache this message for prompt caching */
359
+ cache?: boolean;
360
+ }
361
+ declare const toolMessageSchema: z.ZodObject<{
362
+ id: z.ZodString;
363
+ type: z.ZodLiteral<"toolMessage">;
364
+ contents: z.ZodArray<z.ZodObject<{
365
+ id: z.ZodString;
366
+ type: z.ZodLiteral<"toolResultPart">;
367
+ toolCallId: z.ZodString;
368
+ toolName: z.ZodString;
369
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
370
+ id: z.ZodString;
371
+ type: z.ZodLiteral<"textPart">;
372
+ text: z.ZodString;
373
+ }, z.core.$strip>, z.ZodObject<{
374
+ id: z.ZodString;
375
+ type: z.ZodLiteral<"imageInlinePart">;
376
+ encodedData: z.ZodString;
377
+ mimeType: z.ZodString;
378
+ }, z.core.$strip>]>>;
379
+ isError: z.ZodOptional<z.ZodBoolean>;
380
+ }, z.core.$strip>>;
381
+ cache: z.ZodOptional<z.ZodBoolean>;
382
+ }, z.core.$strip>;
383
+ /** All possible message types */
384
+ type Message = InstructionMessage | UserMessage | ExpertMessage | ToolMessage;
385
+ declare const messageSchema: z.ZodUnion<readonly [z.ZodObject<{
386
+ id: z.ZodString;
387
+ type: z.ZodLiteral<"instructionMessage">;
388
+ contents: z.ZodArray<z.ZodObject<{
389
+ id: z.ZodString;
390
+ type: z.ZodLiteral<"textPart">;
391
+ text: z.ZodString;
392
+ }, z.core.$strip>>;
393
+ cache: z.ZodOptional<z.ZodBoolean>;
394
+ }, z.core.$strip>, z.ZodObject<{
395
+ id: z.ZodString;
396
+ type: z.ZodLiteral<"userMessage">;
397
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
398
+ id: z.ZodString;
399
+ type: z.ZodLiteral<"textPart">;
400
+ text: z.ZodString;
401
+ }, z.core.$strip>, z.ZodObject<{
402
+ id: z.ZodString;
403
+ type: z.ZodLiteral<"imageUrlPart">;
404
+ url: z.ZodURL;
405
+ mimeType: z.ZodString;
406
+ }, z.core.$strip>, z.ZodObject<{
407
+ id: z.ZodString;
408
+ type: z.ZodLiteral<"imageInlinePart">;
409
+ encodedData: z.ZodString;
410
+ mimeType: z.ZodString;
411
+ }, z.core.$strip>, z.ZodObject<{
412
+ id: z.ZodString;
413
+ type: z.ZodLiteral<"imageBinaryPart">;
414
+ data: z.ZodString;
415
+ mimeType: z.ZodString;
416
+ }, z.core.$strip>, z.ZodObject<{
417
+ id: z.ZodString;
418
+ type: z.ZodLiteral<"fileUrlPart">;
419
+ url: z.ZodString;
420
+ mimeType: z.ZodString;
421
+ }, z.core.$strip>, z.ZodObject<{
422
+ id: z.ZodString;
423
+ type: z.ZodLiteral<"fileInlinePart">;
424
+ encodedData: z.ZodString;
425
+ mimeType: z.ZodString;
426
+ }, z.core.$strip>, z.ZodObject<{
427
+ id: z.ZodString;
428
+ type: z.ZodLiteral<"fileBinaryPart">;
429
+ data: z.ZodString;
430
+ mimeType: z.ZodString;
431
+ }, z.core.$strip>]>>;
432
+ cache: z.ZodOptional<z.ZodBoolean>;
433
+ }, z.core.$strip>, z.ZodObject<{
434
+ id: z.ZodString;
435
+ type: z.ZodLiteral<"expertMessage">;
436
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
437
+ id: z.ZodString;
438
+ type: z.ZodLiteral<"textPart">;
439
+ text: z.ZodString;
440
+ }, z.core.$strip>, z.ZodObject<{
441
+ id: z.ZodString;
442
+ type: z.ZodLiteral<"toolCallPart">;
443
+ toolCallId: z.ZodString;
444
+ toolName: z.ZodString;
445
+ args: z.ZodUnknown;
446
+ }, z.core.$strip>]>>;
447
+ cache: z.ZodOptional<z.ZodBoolean>;
448
+ }, z.core.$strip>, z.ZodObject<{
449
+ id: z.ZodString;
450
+ type: z.ZodLiteral<"toolMessage">;
451
+ contents: z.ZodArray<z.ZodObject<{
452
+ id: z.ZodString;
453
+ type: z.ZodLiteral<"toolResultPart">;
454
+ toolCallId: z.ZodString;
455
+ toolName: z.ZodString;
456
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
457
+ id: z.ZodString;
458
+ type: z.ZodLiteral<"textPart">;
459
+ text: z.ZodString;
460
+ }, z.core.$strip>, z.ZodObject<{
461
+ id: z.ZodString;
462
+ type: z.ZodLiteral<"imageInlinePart">;
463
+ encodedData: z.ZodString;
464
+ mimeType: z.ZodString;
465
+ }, z.core.$strip>]>>;
466
+ isError: z.ZodOptional<z.ZodBoolean>;
467
+ }, z.core.$strip>>;
468
+ cache: z.ZodOptional<z.ZodBoolean>;
469
+ }, z.core.$strip>]>;
470
+
471
+ /** Token usage statistics for a single step or run */
472
+ interface Usage {
473
+ /** Number of tokens in the input prompt */
474
+ inputTokens: number;
475
+ /** Number of tokens generated in the response */
476
+ outputTokens: number;
477
+ /** Number of tokens used for reasoning (extended thinking) */
478
+ reasoningTokens: number;
479
+ /** Total tokens (input + output) */
480
+ totalTokens: number;
481
+ /** Number of input tokens served from cache */
482
+ cachedInputTokens: number;
483
+ }
484
+ declare const usageSchema: z.ZodObject<{
485
+ inputTokens: z.ZodNumber;
486
+ outputTokens: z.ZodNumber;
487
+ reasoningTokens: z.ZodNumber;
488
+ totalTokens: z.ZodNumber;
489
+ cachedInputTokens: z.ZodNumber;
490
+ }, z.core.$strip>;
491
+
492
+ /** Status of a checkpoint in the execution lifecycle */
493
+ type CheckpointStatus = "init" | "proceeding" | "completed" | "stoppedByInteractiveTool" | "stoppedByDelegate" | "stoppedByExceededMaxSteps" | "stoppedByError";
40
494
  declare const checkpointStatusSchema: z.ZodEnum<{
41
495
  init: "init";
42
496
  proceeding: "proceeding";
@@ -46,7 +500,67 @@ declare const checkpointStatusSchema: z.ZodEnum<{
46
500
  stoppedByExceededMaxSteps: "stoppedByExceededMaxSteps";
47
501
  stoppedByError: "stoppedByError";
48
502
  }>;
49
- type CheckpointStatus = z.infer<typeof checkpointStatusSchema>;
503
+ /**
504
+ * A checkpoint represents a point-in-time snapshot of an Expert's execution state.
505
+ * Used for resuming, debugging, and observability.
506
+ */
507
+ interface Checkpoint {
508
+ /** Unique identifier for this checkpoint */
509
+ id: string;
510
+ /** Run ID this checkpoint belongs to */
511
+ runId: string;
512
+ /** Current execution status */
513
+ status: CheckpointStatus;
514
+ /** Current step number */
515
+ stepNumber: number;
516
+ /** All messages in the conversation so far */
517
+ messages: Message[];
518
+ /** Expert executing this checkpoint */
519
+ expert: {
520
+ /** Expert key (e.g., "my-expert@1.0.0") */
521
+ key: string;
522
+ /** Expert name */
523
+ name: string;
524
+ /** Expert version */
525
+ version: string;
526
+ };
527
+ /** If delegating, information about the target Expert */
528
+ delegateTo?: {
529
+ /** The Expert being delegated to */
530
+ expert: {
531
+ key: string;
532
+ name: string;
533
+ version: string;
534
+ };
535
+ /** Tool call ID that triggered delegation */
536
+ toolCallId: string;
537
+ /** Name of the delegation tool */
538
+ toolName: string;
539
+ /** Query passed to the delegate */
540
+ query: string;
541
+ };
542
+ /** If delegated, information about the parent Expert */
543
+ delegatedBy?: {
544
+ /** The parent Expert that delegated */
545
+ expert: {
546
+ key: string;
547
+ name: string;
548
+ version: string;
549
+ };
550
+ /** Tool call ID from the parent */
551
+ toolCallId: string;
552
+ /** Name of the delegation tool */
553
+ toolName: string;
554
+ /** Checkpoint ID of the parent */
555
+ checkpointId: string;
556
+ };
557
+ /** Accumulated token usage */
558
+ usage: Usage;
559
+ /** Model's context window size in tokens */
560
+ contextWindow?: number;
561
+ /** Context window usage ratio (0-1) */
562
+ contextWindowUsage?: number;
563
+ }
50
564
  declare const checkpointSchema: z.ZodObject<{
51
565
  id: z.ZodString;
52
566
  runId: z.ZodString;
@@ -180,8 +694,178 @@ declare const checkpointSchema: z.ZodObject<{
180
694
  contextWindow: z.ZodOptional<z.ZodNumber>;
181
695
  contextWindowUsage: z.ZodOptional<z.ZodNumber>;
182
696
  }, z.core.$strip>;
183
- type Checkpoint = z.infer<typeof checkpointSchema>;
184
697
 
698
+ /** MCP skill using stdio transport */
699
+ interface McpStdioSkill {
700
+ type: "mcpStdioSkill";
701
+ /** Skill name (derived from key) */
702
+ name: string;
703
+ /** Human-readable description */
704
+ description?: string;
705
+ /** Usage rules for the LLM */
706
+ rule?: string;
707
+ /** Tool names to include (whitelist) */
708
+ pick: string[];
709
+ /** Tool names to exclude (blacklist) */
710
+ omit: string[];
711
+ /** Command to execute (e.g., "npx") */
712
+ command: string;
713
+ /** Package name for npx/uvx */
714
+ packageName?: string;
715
+ /** Additional arguments */
716
+ args: string[];
717
+ /** Environment variables required by this skill */
718
+ requiredEnv: string[];
719
+ /** Whether to delay initialization until first use */
720
+ lazyInit: boolean;
721
+ }
722
+ declare const mcpStdioSkillSchema: z.ZodObject<{
723
+ type: z.ZodLiteral<"mcpStdioSkill">;
724
+ name: z.ZodString;
725
+ description: z.ZodOptional<z.ZodString>;
726
+ rule: z.ZodOptional<z.ZodString>;
727
+ pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
728
+ omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
729
+ command: z.ZodString;
730
+ packageName: z.ZodOptional<z.ZodString>;
731
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
732
+ requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
733
+ lazyInit: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
734
+ }, z.core.$strip>;
735
+ /** MCP skill using SSE transport */
736
+ interface McpSseSkill {
737
+ type: "mcpSseSkill";
738
+ /** Skill name (derived from key) */
739
+ name: string;
740
+ /** Human-readable description */
741
+ description?: string;
742
+ /** Usage rules for the LLM */
743
+ rule?: string;
744
+ /** Tool names to include (whitelist) */
745
+ pick: string[];
746
+ /** Tool names to exclude (blacklist) */
747
+ omit: string[];
748
+ /** SSE endpoint URL */
749
+ endpoint: string;
750
+ }
751
+ declare const mcpSseSkillSchema: z.ZodObject<{
752
+ type: z.ZodLiteral<"mcpSseSkill">;
753
+ name: z.ZodString;
754
+ description: z.ZodOptional<z.ZodString>;
755
+ rule: z.ZodOptional<z.ZodString>;
756
+ pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
757
+ omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
758
+ endpoint: z.ZodString;
759
+ }, z.core.$strip>;
760
+ /** Definition of an interactive tool within an interactive skill */
761
+ interface InteractiveTool {
762
+ /** Tool name */
763
+ name: string;
764
+ /** Human-readable description */
765
+ description?: string;
766
+ /** JSON Schema for tool input as a string */
767
+ inputJsonSchema: string;
768
+ }
769
+ declare const interactiveToolSchema: z.ZodObject<{
770
+ name: z.ZodString;
771
+ description: z.ZodOptional<z.ZodString>;
772
+ inputJsonSchema: z.ZodString;
773
+ }, z.core.$strip>;
774
+ /** Skill that requires human interaction to complete tool calls */
775
+ interface InteractiveSkill {
776
+ type: "interactiveSkill";
777
+ /** Skill name (derived from key) */
778
+ name: string;
779
+ /** Human-readable description */
780
+ description?: string;
781
+ /** Usage rules for the LLM */
782
+ rule?: string;
783
+ /** Map of tool name to tool definition */
784
+ tools: Record<string, InteractiveTool>;
785
+ }
786
+ declare const interactiveSkillSchema: z.ZodObject<{
787
+ type: z.ZodLiteral<"interactiveSkill">;
788
+ name: z.ZodString;
789
+ description: z.ZodOptional<z.ZodString>;
790
+ rule: z.ZodOptional<z.ZodString>;
791
+ tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
792
+ description: z.ZodOptional<z.ZodString>;
793
+ inputJsonSchema: z.ZodString;
794
+ }, z.core.$strip>>, z.ZodTransform<{
795
+ [k: string]: {
796
+ name: string;
797
+ inputJsonSchema: string;
798
+ description?: string | undefined;
799
+ };
800
+ }, Record<string, {
801
+ inputJsonSchema: string;
802
+ description?: string | undefined;
803
+ }>>>;
804
+ }, z.core.$strip>;
805
+ /** All possible skill types */
806
+ type Skill = McpStdioSkill | McpSseSkill | InteractiveSkill;
807
+ declare const skillSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
808
+ type: z.ZodLiteral<"mcpStdioSkill">;
809
+ name: z.ZodString;
810
+ description: z.ZodOptional<z.ZodString>;
811
+ rule: z.ZodOptional<z.ZodString>;
812
+ pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
813
+ omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
814
+ command: z.ZodString;
815
+ packageName: z.ZodOptional<z.ZodString>;
816
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
817
+ requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
818
+ lazyInit: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
819
+ }, z.core.$strip>, z.ZodObject<{
820
+ type: z.ZodLiteral<"mcpSseSkill">;
821
+ name: z.ZodString;
822
+ description: z.ZodOptional<z.ZodString>;
823
+ rule: z.ZodOptional<z.ZodString>;
824
+ pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
825
+ omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
826
+ endpoint: z.ZodString;
827
+ }, z.core.$strip>, z.ZodObject<{
828
+ type: z.ZodLiteral<"interactiveSkill">;
829
+ name: z.ZodString;
830
+ description: z.ZodOptional<z.ZodString>;
831
+ rule: z.ZodOptional<z.ZodString>;
832
+ tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
833
+ description: z.ZodOptional<z.ZodString>;
834
+ inputJsonSchema: z.ZodString;
835
+ }, z.core.$strip>>, z.ZodTransform<{
836
+ [k: string]: {
837
+ name: string;
838
+ inputJsonSchema: string;
839
+ description?: string | undefined;
840
+ };
841
+ }, Record<string, {
842
+ inputJsonSchema: string;
843
+ description?: string | undefined;
844
+ }>>>;
845
+ }, z.core.$strip>], "type">;
846
+
847
+ /**
848
+ * An Expert definition - an AI agent with specific skills and instructions.
849
+ * Experts can delegate to other Experts and use MCP tools.
850
+ */
851
+ interface Expert {
852
+ /** Unique key identifying this Expert (e.g., "my-expert" or "my-expert@1.0.0") */
853
+ key: string;
854
+ /** Display name for the Expert */
855
+ name: string;
856
+ /** Semantic version string */
857
+ version: string;
858
+ /** Human-readable description of what this Expert does */
859
+ description?: string;
860
+ /** System instruction defining the Expert's behavior */
861
+ instruction: string;
862
+ /** Map of skill name to skill configuration */
863
+ skills: Record<string, Skill>;
864
+ /** List of Expert keys this Expert can delegate to */
865
+ delegates: string[];
866
+ /** Tags for categorization and discovery */
867
+ tags: string[];
868
+ }
185
869
  declare const expertSchema: z.ZodObject<{
186
870
  key: z.ZodString;
187
871
  name: z.ZodString;
@@ -190,8 +874,8 @@ declare const expertSchema: z.ZodObject<{
190
874
  instruction: z.ZodString;
191
875
  skills: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
192
876
  type: z.ZodLiteral<"mcpStdioSkill">;
193
- args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
194
877
  description: z.ZodOptional<z.ZodString>;
878
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
195
879
  rule: z.ZodOptional<z.ZodString>;
196
880
  pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
197
881
  omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
@@ -290,412 +974,255 @@ declare const expertSchema: z.ZodObject<{
290
974
  delegates: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
291
975
  tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
292
976
  }, z.core.$strip>;
293
- type Expert = z.infer<typeof expertSchema>;
294
977
 
295
- /**
296
- * Message Part Schemas
297
- */
298
- declare const basePartSchema: z.ZodObject<{
299
- id: z.ZodString;
300
- }, z.core.$strip>;
301
- type BasePart = z.infer<typeof basePartSchema>;
302
- declare const textPartSchema: z.ZodObject<{
303
- id: z.ZodString;
304
- type: z.ZodLiteral<"textPart">;
305
- text: z.ZodString;
306
- }, z.core.$strip>;
307
- type TextPart = z.infer<typeof textPartSchema>;
308
- declare const imageUrlPartSchema: z.ZodObject<{
309
- id: z.ZodString;
310
- type: z.ZodLiteral<"imageUrlPart">;
311
- url: z.ZodURL;
312
- mimeType: z.ZodString;
313
- }, z.core.$strip>;
314
- type ImageUrlPart = z.infer<typeof imageUrlPartSchema>;
315
- declare const imageInlinePartSchema: z.ZodObject<{
316
- id: z.ZodString;
317
- type: z.ZodLiteral<"imageInlinePart">;
318
- encodedData: z.ZodString;
319
- mimeType: z.ZodString;
320
- }, z.core.$strip>;
321
- type ImageInlinePart = z.infer<typeof imageInlinePartSchema>;
322
- declare const imageBinaryPartSchema: z.ZodObject<{
323
- id: z.ZodString;
324
- type: z.ZodLiteral<"imageBinaryPart">;
325
- data: z.ZodString;
326
- mimeType: z.ZodString;
327
- }, z.core.$strip>;
328
- type ImageBinaryPart = z.infer<typeof imageBinaryPartSchema>;
329
- declare const fileUrlPartSchema: z.ZodObject<{
330
- id: z.ZodString;
331
- type: z.ZodLiteral<"fileUrlPart">;
332
- url: z.ZodString;
333
- mimeType: z.ZodString;
334
- }, z.core.$strip>;
335
- type FileUrlPart = z.infer<typeof fileUrlPartSchema>;
336
- declare const fileInlinePartSchema: z.ZodObject<{
337
- id: z.ZodString;
338
- type: z.ZodLiteral<"fileInlinePart">;
339
- encodedData: z.ZodString;
340
- mimeType: z.ZodString;
341
- }, z.core.$strip>;
342
- type FileInlinePart = z.infer<typeof fileInlinePartSchema>;
343
- declare const fileBinaryPartSchema: z.ZodObject<{
344
- id: z.ZodString;
345
- type: z.ZodLiteral<"fileBinaryPart">;
346
- data: z.ZodString;
347
- mimeType: z.ZodString;
978
+ declare const anthropicSettingSchema: z.ZodObject<{
979
+ baseUrl: z.ZodOptional<z.ZodString>;
980
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
348
981
  }, z.core.$strip>;
349
- type FileBinaryPart = z.infer<typeof fileBinaryPartSchema>;
350
- declare const toolCallPartSchema: z.ZodObject<{
351
- id: z.ZodString;
352
- type: z.ZodLiteral<"toolCallPart">;
353
- toolCallId: z.ZodString;
354
- toolName: z.ZodString;
355
- args: z.ZodUnknown;
982
+ declare const googleSettingSchema: z.ZodObject<{
983
+ baseUrl: z.ZodOptional<z.ZodString>;
984
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
356
985
  }, z.core.$strip>;
357
- type ToolCallPart = z.infer<typeof toolCallPartSchema>;
358
- declare const toolResultPartSchema: z.ZodObject<{
359
- id: z.ZodString;
360
- type: z.ZodLiteral<"toolResultPart">;
361
- toolCallId: z.ZodString;
362
- toolName: z.ZodString;
363
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
364
- id: z.ZodString;
365
- type: z.ZodLiteral<"textPart">;
366
- text: z.ZodString;
367
- }, z.core.$strip>, z.ZodObject<{
368
- id: z.ZodString;
369
- type: z.ZodLiteral<"imageInlinePart">;
370
- encodedData: z.ZodString;
371
- mimeType: z.ZodString;
372
- }, z.core.$strip>]>>;
373
- isError: z.ZodOptional<z.ZodBoolean>;
986
+ declare const openAiSettingSchema: z.ZodObject<{
987
+ baseUrl: z.ZodOptional<z.ZodString>;
988
+ organization: z.ZodOptional<z.ZodString>;
989
+ project: z.ZodOptional<z.ZodString>;
990
+ name: z.ZodOptional<z.ZodString>;
991
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
374
992
  }, z.core.$strip>;
375
- type ToolResultPart = z.infer<typeof toolResultPartSchema>;
376
- declare const messagePartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
377
- id: z.ZodString;
378
- type: z.ZodLiteral<"textPart">;
379
- text: z.ZodString;
380
- }, z.core.$strip>, z.ZodObject<{
381
- id: z.ZodString;
382
- type: z.ZodLiteral<"imageUrlPart">;
383
- url: z.ZodURL;
384
- mimeType: z.ZodString;
385
- }, z.core.$strip>, z.ZodObject<{
386
- id: z.ZodString;
387
- type: z.ZodLiteral<"imageInlinePart">;
388
- encodedData: z.ZodString;
389
- mimeType: z.ZodString;
390
- }, z.core.$strip>, z.ZodObject<{
391
- id: z.ZodString;
392
- type: z.ZodLiteral<"imageBinaryPart">;
393
- data: z.ZodString;
394
- mimeType: z.ZodString;
395
- }, z.core.$strip>, z.ZodObject<{
396
- id: z.ZodString;
397
- type: z.ZodLiteral<"fileUrlPart">;
398
- url: z.ZodString;
399
- mimeType: z.ZodString;
400
- }, z.core.$strip>, z.ZodObject<{
401
- id: z.ZodString;
402
- type: z.ZodLiteral<"fileInlinePart">;
403
- encodedData: z.ZodString;
404
- mimeType: z.ZodString;
405
- }, z.core.$strip>, z.ZodObject<{
406
- id: z.ZodString;
407
- type: z.ZodLiteral<"fileBinaryPart">;
408
- data: z.ZodString;
409
- mimeType: z.ZodString;
410
- }, z.core.$strip>, z.ZodObject<{
411
- id: z.ZodString;
412
- type: z.ZodLiteral<"toolCallPart">;
413
- toolCallId: z.ZodString;
414
- toolName: z.ZodString;
415
- args: z.ZodUnknown;
416
- }, z.core.$strip>, z.ZodObject<{
417
- id: z.ZodString;
418
- type: z.ZodLiteral<"toolResultPart">;
419
- toolCallId: z.ZodString;
420
- toolName: z.ZodString;
421
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
422
- id: z.ZodString;
423
- type: z.ZodLiteral<"textPart">;
424
- text: z.ZodString;
425
- }, z.core.$strip>, z.ZodObject<{
426
- id: z.ZodString;
427
- type: z.ZodLiteral<"imageInlinePart">;
428
- encodedData: z.ZodString;
429
- mimeType: z.ZodString;
430
- }, z.core.$strip>]>>;
431
- isError: z.ZodOptional<z.ZodBoolean>;
432
- }, z.core.$strip>], "type">;
433
- type MessagePart = z.infer<typeof messagePartSchema>;
434
-
435
- declare const instructionMessageSchema: z.ZodObject<{
436
- id: z.ZodString;
437
- type: z.ZodLiteral<"instructionMessage">;
438
- contents: z.ZodArray<z.ZodObject<{
439
- id: z.ZodString;
440
- type: z.ZodLiteral<"textPart">;
441
- text: z.ZodString;
442
- }, z.core.$strip>>;
443
- cache: z.ZodOptional<z.ZodBoolean>;
993
+ declare const ollamaSettingSchema: z.ZodObject<{
994
+ baseUrl: z.ZodOptional<z.ZodString>;
995
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
444
996
  }, z.core.$strip>;
445
- type InstructionMessage = z.infer<typeof instructionMessageSchema>;
446
- declare const userMessageSchema: z.ZodObject<{
447
- id: z.ZodString;
448
- type: z.ZodLiteral<"userMessage">;
449
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
450
- id: z.ZodString;
451
- type: z.ZodLiteral<"textPart">;
452
- text: z.ZodString;
453
- }, z.core.$strip>, z.ZodObject<{
454
- id: z.ZodString;
455
- type: z.ZodLiteral<"imageUrlPart">;
456
- url: z.ZodURL;
457
- mimeType: z.ZodString;
458
- }, z.core.$strip>, z.ZodObject<{
459
- id: z.ZodString;
460
- type: z.ZodLiteral<"imageInlinePart">;
461
- encodedData: z.ZodString;
462
- mimeType: z.ZodString;
463
- }, z.core.$strip>, z.ZodObject<{
464
- id: z.ZodString;
465
- type: z.ZodLiteral<"imageBinaryPart">;
466
- data: z.ZodString;
467
- mimeType: z.ZodString;
468
- }, z.core.$strip>, z.ZodObject<{
469
- id: z.ZodString;
470
- type: z.ZodLiteral<"fileUrlPart">;
471
- url: z.ZodString;
472
- mimeType: z.ZodString;
473
- }, z.core.$strip>, z.ZodObject<{
474
- id: z.ZodString;
475
- type: z.ZodLiteral<"fileInlinePart">;
476
- encodedData: z.ZodString;
477
- mimeType: z.ZodString;
478
- }, z.core.$strip>, z.ZodObject<{
479
- id: z.ZodString;
480
- type: z.ZodLiteral<"fileBinaryPart">;
481
- data: z.ZodString;
482
- mimeType: z.ZodString;
483
- }, z.core.$strip>]>>;
484
- cache: z.ZodOptional<z.ZodBoolean>;
997
+ declare const azureOpenAiSettingSchema: z.ZodObject<{
998
+ resourceName: z.ZodOptional<z.ZodString>;
999
+ apiVersion: z.ZodOptional<z.ZodString>;
1000
+ baseUrl: z.ZodOptional<z.ZodString>;
1001
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1002
+ useDeploymentBasedUrls: z.ZodOptional<z.ZodBoolean>;
485
1003
  }, z.core.$strip>;
486
- type UserMessage = z.infer<typeof userMessageSchema>;
487
- declare const expertMessageSchema: z.ZodObject<{
488
- id: z.ZodString;
489
- type: z.ZodLiteral<"expertMessage">;
490
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
491
- id: z.ZodString;
492
- type: z.ZodLiteral<"textPart">;
493
- text: z.ZodString;
494
- }, z.core.$strip>, z.ZodObject<{
495
- id: z.ZodString;
496
- type: z.ZodLiteral<"toolCallPart">;
497
- toolCallId: z.ZodString;
498
- toolName: z.ZodString;
499
- args: z.ZodUnknown;
500
- }, z.core.$strip>]>>;
501
- cache: z.ZodOptional<z.ZodBoolean>;
1004
+ declare const amazonBedrockSettingSchema: z.ZodObject<{
1005
+ region: z.ZodOptional<z.ZodString>;
502
1006
  }, z.core.$strip>;
503
- type ExpertMessage = z.infer<typeof expertMessageSchema>;
504
- declare const toolMessageSchema: z.ZodObject<{
505
- id: z.ZodString;
506
- type: z.ZodLiteral<"toolMessage">;
507
- contents: z.ZodArray<z.ZodObject<{
508
- id: z.ZodString;
509
- type: z.ZodLiteral<"toolResultPart">;
510
- toolCallId: z.ZodString;
511
- toolName: z.ZodString;
512
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
513
- id: z.ZodString;
514
- type: z.ZodLiteral<"textPart">;
515
- text: z.ZodString;
516
- }, z.core.$strip>, z.ZodObject<{
517
- id: z.ZodString;
518
- type: z.ZodLiteral<"imageInlinePart">;
519
- encodedData: z.ZodString;
520
- mimeType: z.ZodString;
521
- }, z.core.$strip>]>>;
522
- isError: z.ZodOptional<z.ZodBoolean>;
523
- }, z.core.$strip>>;
524
- cache: z.ZodOptional<z.ZodBoolean>;
1007
+ declare const googleVertexSettingSchema: z.ZodObject<{
1008
+ project: z.ZodOptional<z.ZodString>;
1009
+ location: z.ZodOptional<z.ZodString>;
1010
+ baseUrl: z.ZodOptional<z.ZodString>;
1011
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
525
1012
  }, z.core.$strip>;
526
- type ToolMessage = z.infer<typeof toolMessageSchema>;
527
- declare const messageSchema: z.ZodUnion<readonly [z.ZodObject<{
528
- id: z.ZodString;
529
- type: z.ZodLiteral<"instructionMessage">;
530
- contents: z.ZodArray<z.ZodObject<{
531
- id: z.ZodString;
532
- type: z.ZodLiteral<"textPart">;
533
- text: z.ZodString;
534
- }, z.core.$strip>>;
535
- cache: z.ZodOptional<z.ZodBoolean>;
536
- }, z.core.$strip>, z.ZodObject<{
537
- id: z.ZodString;
538
- type: z.ZodLiteral<"userMessage">;
539
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
540
- id: z.ZodString;
541
- type: z.ZodLiteral<"textPart">;
542
- text: z.ZodString;
543
- }, z.core.$strip>, z.ZodObject<{
544
- id: z.ZodString;
545
- type: z.ZodLiteral<"imageUrlPart">;
546
- url: z.ZodURL;
547
- mimeType: z.ZodString;
548
- }, z.core.$strip>, z.ZodObject<{
549
- id: z.ZodString;
550
- type: z.ZodLiteral<"imageInlinePart">;
551
- encodedData: z.ZodString;
552
- mimeType: z.ZodString;
553
- }, z.core.$strip>, z.ZodObject<{
554
- id: z.ZodString;
555
- type: z.ZodLiteral<"imageBinaryPart">;
556
- data: z.ZodString;
557
- mimeType: z.ZodString;
558
- }, z.core.$strip>, z.ZodObject<{
559
- id: z.ZodString;
560
- type: z.ZodLiteral<"fileUrlPart">;
561
- url: z.ZodString;
562
- mimeType: z.ZodString;
563
- }, z.core.$strip>, z.ZodObject<{
564
- id: z.ZodString;
565
- type: z.ZodLiteral<"fileInlinePart">;
566
- encodedData: z.ZodString;
567
- mimeType: z.ZodString;
568
- }, z.core.$strip>, z.ZodObject<{
569
- id: z.ZodString;
570
- type: z.ZodLiteral<"fileBinaryPart">;
571
- data: z.ZodString;
572
- mimeType: z.ZodString;
573
- }, z.core.$strip>]>>;
574
- cache: z.ZodOptional<z.ZodBoolean>;
575
- }, z.core.$strip>, z.ZodObject<{
576
- id: z.ZodString;
577
- type: z.ZodLiteral<"expertMessage">;
578
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
579
- id: z.ZodString;
580
- type: z.ZodLiteral<"textPart">;
581
- text: z.ZodString;
582
- }, z.core.$strip>, z.ZodObject<{
583
- id: z.ZodString;
584
- type: z.ZodLiteral<"toolCallPart">;
585
- toolCallId: z.ZodString;
586
- toolName: z.ZodString;
587
- args: z.ZodUnknown;
588
- }, z.core.$strip>]>>;
589
- cache: z.ZodOptional<z.ZodBoolean>;
590
- }, z.core.$strip>, z.ZodObject<{
591
- id: z.ZodString;
592
- type: z.ZodLiteral<"toolMessage">;
593
- contents: z.ZodArray<z.ZodObject<{
594
- id: z.ZodString;
595
- type: z.ZodLiteral<"toolResultPart">;
596
- toolCallId: z.ZodString;
597
- toolName: z.ZodString;
598
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
599
- id: z.ZodString;
600
- type: z.ZodLiteral<"textPart">;
601
- text: z.ZodString;
602
- }, z.core.$strip>, z.ZodObject<{
603
- id: z.ZodString;
604
- type: z.ZodLiteral<"imageInlinePart">;
605
- encodedData: z.ZodString;
606
- mimeType: z.ZodString;
607
- }, z.core.$strip>]>>;
608
- isError: z.ZodOptional<z.ZodBoolean>;
609
- }, z.core.$strip>>;
610
- cache: z.ZodOptional<z.ZodBoolean>;
611
- }, z.core.$strip>]>;
612
- type Message = z.infer<typeof messageSchema>;
613
-
614
- declare const providerTableSchema: z.ZodObject<{
615
- providerName: z.ZodEnum<{
616
- anthropic: "anthropic";
617
- google: "google";
618
- openai: "openai";
619
- ollama: "ollama";
620
- "azure-openai": "azure-openai";
621
- "amazon-bedrock": "amazon-bedrock";
622
- "google-vertex": "google-vertex";
623
- }>;
624
- setting: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1013
+ declare const deepseekSettingSchema: z.ZodObject<{
1014
+ baseUrl: z.ZodOptional<z.ZodString>;
1015
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1016
+ }, z.core.$strip>;
1017
+ /** Provider configuration in perstack.toml */
1018
+ type ProviderTable = {
1019
+ providerName: "anthropic";
1020
+ setting?: z.infer<typeof anthropicSettingSchema>;
1021
+ } | {
1022
+ providerName: "google";
1023
+ setting?: z.infer<typeof googleSettingSchema>;
1024
+ } | {
1025
+ providerName: "openai";
1026
+ setting?: z.infer<typeof openAiSettingSchema>;
1027
+ } | {
1028
+ providerName: "ollama";
1029
+ setting?: z.infer<typeof ollamaSettingSchema>;
1030
+ } | {
1031
+ providerName: "azure-openai";
1032
+ setting?: z.infer<typeof azureOpenAiSettingSchema>;
1033
+ } | {
1034
+ providerName: "amazon-bedrock";
1035
+ setting?: z.infer<typeof amazonBedrockSettingSchema>;
1036
+ } | {
1037
+ providerName: "google-vertex";
1038
+ setting?: z.infer<typeof googleVertexSettingSchema>;
1039
+ } | {
1040
+ providerName: "deepseek";
1041
+ setting?: z.infer<typeof deepseekSettingSchema>;
1042
+ };
1043
+ declare const providerTableSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1044
+ providerName: z.ZodLiteral<"anthropic">;
1045
+ setting: z.ZodOptional<z.ZodObject<{
625
1046
  baseUrl: z.ZodOptional<z.ZodString>;
626
1047
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
627
- }, z.core.$strip>, z.ZodObject<{
1048
+ }, z.core.$strip>>;
1049
+ }, z.core.$strip>, z.ZodObject<{
1050
+ providerName: z.ZodLiteral<"google">;
1051
+ setting: z.ZodOptional<z.ZodObject<{
628
1052
  baseUrl: z.ZodOptional<z.ZodString>;
629
1053
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
630
- }, z.core.$strip>, z.ZodObject<{
1054
+ }, z.core.$strip>>;
1055
+ }, z.core.$strip>, z.ZodObject<{
1056
+ providerName: z.ZodLiteral<"openai">;
1057
+ setting: z.ZodOptional<z.ZodObject<{
631
1058
  baseUrl: z.ZodOptional<z.ZodString>;
632
1059
  organization: z.ZodOptional<z.ZodString>;
633
1060
  project: z.ZodOptional<z.ZodString>;
634
1061
  name: z.ZodOptional<z.ZodString>;
635
1062
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
636
- }, z.core.$strip>, z.ZodObject<{
1063
+ }, z.core.$strip>>;
1064
+ }, z.core.$strip>, z.ZodObject<{
1065
+ providerName: z.ZodLiteral<"ollama">;
1066
+ setting: z.ZodOptional<z.ZodObject<{
637
1067
  baseUrl: z.ZodOptional<z.ZodString>;
638
1068
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
639
- }, z.core.$strip>, z.ZodObject<{
1069
+ }, z.core.$strip>>;
1070
+ }, z.core.$strip>, z.ZodObject<{
1071
+ providerName: z.ZodLiteral<"azure-openai">;
1072
+ setting: z.ZodOptional<z.ZodObject<{
640
1073
  resourceName: z.ZodOptional<z.ZodString>;
641
1074
  apiVersion: z.ZodOptional<z.ZodString>;
642
1075
  baseUrl: z.ZodOptional<z.ZodString>;
643
1076
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
644
1077
  useDeploymentBasedUrls: z.ZodOptional<z.ZodBoolean>;
645
- }, z.core.$strip>, z.ZodObject<{
1078
+ }, z.core.$strip>>;
1079
+ }, z.core.$strip>, z.ZodObject<{
1080
+ providerName: z.ZodLiteral<"amazon-bedrock">;
1081
+ setting: z.ZodOptional<z.ZodObject<{
646
1082
  region: z.ZodOptional<z.ZodString>;
647
- }, z.core.$strip>, z.ZodObject<{
1083
+ }, z.core.$strip>>;
1084
+ }, z.core.$strip>, z.ZodObject<{
1085
+ providerName: z.ZodLiteral<"google-vertex">;
1086
+ setting: z.ZodOptional<z.ZodObject<{
648
1087
  project: z.ZodOptional<z.ZodString>;
649
1088
  location: z.ZodOptional<z.ZodString>;
650
1089
  baseUrl: z.ZodOptional<z.ZodString>;
651
1090
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
652
- }, z.core.$strip>]>>;
653
- }, z.core.$strip>;
654
- type ProviderTable = z.infer<typeof providerTableSchema>;
1091
+ }, z.core.$strip>>;
1092
+ }, z.core.$strip>, z.ZodObject<{
1093
+ providerName: z.ZodLiteral<"deepseek">;
1094
+ setting: z.ZodOptional<z.ZodObject<{
1095
+ baseUrl: z.ZodOptional<z.ZodString>;
1096
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1097
+ }, z.core.$strip>>;
1098
+ }, z.core.$strip>], "providerName">;
1099
+ /** Skill configuration in perstack.toml */
1100
+ type PerstackConfigSkill = {
1101
+ type: "mcpStdioSkill";
1102
+ description?: string;
1103
+ rule?: string;
1104
+ pick?: string[];
1105
+ omit?: string[];
1106
+ command: string;
1107
+ packageName?: string;
1108
+ args?: string[];
1109
+ requiredEnv?: string[];
1110
+ } | {
1111
+ type: "mcpSseSkill";
1112
+ description?: string;
1113
+ rule?: string;
1114
+ pick?: string[];
1115
+ omit?: string[];
1116
+ endpoint: string;
1117
+ } | {
1118
+ type: "interactiveSkill";
1119
+ description?: string;
1120
+ rule?: string;
1121
+ tools: Record<string, {
1122
+ description?: string;
1123
+ inputJsonSchema: string;
1124
+ }>;
1125
+ };
1126
+ /** Expert definition in perstack.toml (simplified from full Expert) */
1127
+ interface PerstackConfigExpert {
1128
+ /** Semantic version */
1129
+ version?: string;
1130
+ /** Minimum runtime version required */
1131
+ minRuntimeVersion?: string;
1132
+ /** Description of the Expert */
1133
+ description?: string;
1134
+ /** System instruction */
1135
+ instruction: string;
1136
+ /** Skills configuration */
1137
+ skills?: Record<string, PerstackConfigSkill>;
1138
+ /** Delegates list */
1139
+ delegates?: string[];
1140
+ /** Tags for categorization */
1141
+ tags?: string[];
1142
+ }
655
1143
  /**
656
- * perstack.toml config schema
1144
+ * Configuration loaded from perstack.toml.
1145
+ * This is the primary configuration file for Perstack projects.
657
1146
  */
1147
+ interface PerstackConfig {
1148
+ /** Default provider configuration */
1149
+ provider?: ProviderTable;
1150
+ /** Default model name */
1151
+ model?: string;
1152
+ /** Default temperature (0-1) */
1153
+ temperature?: number;
1154
+ /** Maximum steps per run */
1155
+ maxSteps?: number;
1156
+ /** Maximum retries on generation failure */
1157
+ maxRetries?: number;
1158
+ /** Timeout per generation in milliseconds */
1159
+ timeout?: number;
1160
+ /** Expert definitions */
1161
+ experts?: Record<string, PerstackConfigExpert>;
1162
+ /** Custom Perstack API base URL */
1163
+ perstackApiBaseUrl?: string;
1164
+ /** Custom command for @perstack/base skill */
1165
+ perstackBaseSkillCommand?: string[];
1166
+ /** Paths to .env files */
1167
+ envPath?: string[];
1168
+ }
658
1169
  declare const perstackConfigSchema: z.ZodObject<{
659
- provider: z.ZodOptional<z.ZodObject<{
660
- providerName: z.ZodEnum<{
661
- anthropic: "anthropic";
662
- google: "google";
663
- openai: "openai";
664
- ollama: "ollama";
665
- "azure-openai": "azure-openai";
666
- "amazon-bedrock": "amazon-bedrock";
667
- "google-vertex": "google-vertex";
668
- }>;
669
- setting: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1170
+ provider: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1171
+ providerName: z.ZodLiteral<"anthropic">;
1172
+ setting: z.ZodOptional<z.ZodObject<{
670
1173
  baseUrl: z.ZodOptional<z.ZodString>;
671
1174
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
672
- }, z.core.$strip>, z.ZodObject<{
1175
+ }, z.core.$strip>>;
1176
+ }, z.core.$strip>, z.ZodObject<{
1177
+ providerName: z.ZodLiteral<"google">;
1178
+ setting: z.ZodOptional<z.ZodObject<{
673
1179
  baseUrl: z.ZodOptional<z.ZodString>;
674
1180
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
675
- }, z.core.$strip>, z.ZodObject<{
1181
+ }, z.core.$strip>>;
1182
+ }, z.core.$strip>, z.ZodObject<{
1183
+ providerName: z.ZodLiteral<"openai">;
1184
+ setting: z.ZodOptional<z.ZodObject<{
676
1185
  baseUrl: z.ZodOptional<z.ZodString>;
677
1186
  organization: z.ZodOptional<z.ZodString>;
678
1187
  project: z.ZodOptional<z.ZodString>;
679
1188
  name: z.ZodOptional<z.ZodString>;
680
1189
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
681
- }, z.core.$strip>, z.ZodObject<{
1190
+ }, z.core.$strip>>;
1191
+ }, z.core.$strip>, z.ZodObject<{
1192
+ providerName: z.ZodLiteral<"ollama">;
1193
+ setting: z.ZodOptional<z.ZodObject<{
682
1194
  baseUrl: z.ZodOptional<z.ZodString>;
683
1195
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
684
- }, z.core.$strip>, z.ZodObject<{
1196
+ }, z.core.$strip>>;
1197
+ }, z.core.$strip>, z.ZodObject<{
1198
+ providerName: z.ZodLiteral<"azure-openai">;
1199
+ setting: z.ZodOptional<z.ZodObject<{
685
1200
  resourceName: z.ZodOptional<z.ZodString>;
686
1201
  apiVersion: z.ZodOptional<z.ZodString>;
687
1202
  baseUrl: z.ZodOptional<z.ZodString>;
688
1203
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
689
1204
  useDeploymentBasedUrls: z.ZodOptional<z.ZodBoolean>;
690
- }, z.core.$strip>, z.ZodObject<{
1205
+ }, z.core.$strip>>;
1206
+ }, z.core.$strip>, z.ZodObject<{
1207
+ providerName: z.ZodLiteral<"amazon-bedrock">;
1208
+ setting: z.ZodOptional<z.ZodObject<{
691
1209
  region: z.ZodOptional<z.ZodString>;
692
- }, z.core.$strip>, z.ZodObject<{
1210
+ }, z.core.$strip>>;
1211
+ }, z.core.$strip>, z.ZodObject<{
1212
+ providerName: z.ZodLiteral<"google-vertex">;
1213
+ setting: z.ZodOptional<z.ZodObject<{
693
1214
  project: z.ZodOptional<z.ZodString>;
694
1215
  location: z.ZodOptional<z.ZodString>;
695
1216
  baseUrl: z.ZodOptional<z.ZodString>;
696
1217
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
697
- }, z.core.$strip>]>>;
698
- }, z.core.$strip>>;
1218
+ }, z.core.$strip>>;
1219
+ }, z.core.$strip>, z.ZodObject<{
1220
+ providerName: z.ZodLiteral<"deepseek">;
1221
+ setting: z.ZodOptional<z.ZodObject<{
1222
+ baseUrl: z.ZodOptional<z.ZodString>;
1223
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1224
+ }, z.core.$strip>>;
1225
+ }, z.core.$strip>], "providerName">>;
699
1226
  model: z.ZodOptional<z.ZodString>;
700
1227
  temperature: z.ZodOptional<z.ZodNumber>;
701
1228
  maxSteps: z.ZodOptional<z.ZodNumber>;
@@ -733,38 +1260,76 @@ declare const perstackConfigSchema: z.ZodObject<{
733
1260
  }, z.core.$strip>>;
734
1261
  }, z.core.$strip>], "type">>>;
735
1262
  delegates: z.ZodOptional<z.ZodArray<z.ZodString>>;
1263
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
736
1264
  }, z.core.$strip>>>;
737
1265
  perstackApiBaseUrl: z.ZodOptional<z.ZodURL>;
738
1266
  perstackBaseSkillCommand: z.ZodOptional<z.ZodArray<z.ZodString>>;
739
1267
  envPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
740
1268
  }, z.core.$strip>;
741
- type PerstackConfig = z.infer<typeof perstackConfigSchema>;
742
1269
 
1270
+ /** HTTP headers for API requests */
1271
+ type Headers = Record<string, string> | undefined;
743
1272
  declare const headersSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1273
+ /** Supported LLM provider names */
1274
+ type ProviderName = "anthropic" | "google" | "openai" | "ollama" | "azure-openai" | "amazon-bedrock" | "google-vertex" | "deepseek";
744
1275
  declare const providerNameSchema: z.ZodEnum<{
745
1276
  anthropic: "anthropic";
746
1277
  google: "google";
747
1278
  openai: "openai";
1279
+ deepseek: "deepseek";
748
1280
  ollama: "ollama";
749
1281
  "azure-openai": "azure-openai";
750
1282
  "amazon-bedrock": "amazon-bedrock";
751
1283
  "google-vertex": "google-vertex";
752
1284
  }>;
753
- type ProviderName = z.infer<typeof providerNameSchema>;
1285
+ /** Anthropic provider configuration */
1286
+ interface AnthropicProviderConfig {
1287
+ providerName: "anthropic";
1288
+ /** API key for Anthropic */
1289
+ apiKey: string;
1290
+ /** Custom base URL */
1291
+ baseUrl?: string;
1292
+ /** Custom headers */
1293
+ headers?: Headers;
1294
+ }
754
1295
  declare const anthropicProviderConfigSchema: z.ZodObject<{
755
1296
  providerName: z.ZodLiteral<"anthropic">;
756
1297
  apiKey: z.ZodString;
757
1298
  baseUrl: z.ZodOptional<z.ZodString>;
758
1299
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
759
1300
  }, z.core.$strip>;
760
- type AnthropicProviderConfig = z.infer<typeof anthropicProviderConfigSchema>;
1301
+ /** Google Generative AI provider configuration */
1302
+ interface GoogleGenerativeAiProviderConfig {
1303
+ providerName: "google";
1304
+ /** API key for Google */
1305
+ apiKey: string;
1306
+ /** Custom base URL */
1307
+ baseUrl?: string;
1308
+ /** Custom headers */
1309
+ headers?: Headers;
1310
+ }
761
1311
  declare const googleGenerativeAiProviderConfigSchema: z.ZodObject<{
762
1312
  providerName: z.ZodLiteral<"google">;
763
1313
  apiKey: z.ZodString;
764
1314
  baseUrl: z.ZodOptional<z.ZodString>;
765
1315
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
766
1316
  }, z.core.$strip>;
767
- type GoogleGenerativeAiProviderConfig = z.infer<typeof googleGenerativeAiProviderConfigSchema>;
1317
+ /** OpenAI provider configuration */
1318
+ interface OpenAiProviderConfig {
1319
+ providerName: "openai";
1320
+ /** API key for OpenAI */
1321
+ apiKey: string;
1322
+ /** Custom base URL */
1323
+ baseUrl?: string;
1324
+ /** Organization ID */
1325
+ organization?: string;
1326
+ /** Project ID */
1327
+ project?: string;
1328
+ /** Custom name for the provider instance */
1329
+ name?: string;
1330
+ /** Custom headers */
1331
+ headers?: Headers;
1332
+ }
768
1333
  declare const openAiProviderConfigSchema: z.ZodObject<{
769
1334
  providerName: z.ZodLiteral<"openai">;
770
1335
  apiKey: z.ZodString;
@@ -774,13 +1339,35 @@ declare const openAiProviderConfigSchema: z.ZodObject<{
774
1339
  name: z.ZodOptional<z.ZodString>;
775
1340
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
776
1341
  }, z.core.$strip>;
777
- type OpenAiProviderConfig = z.infer<typeof openAiProviderConfigSchema>;
1342
+ /** Ollama provider configuration */
1343
+ interface OllamaProviderConfig {
1344
+ providerName: "ollama";
1345
+ /** Custom base URL (defaults to localhost) */
1346
+ baseUrl?: string;
1347
+ /** Custom headers */
1348
+ headers?: Headers;
1349
+ }
778
1350
  declare const ollamaProviderConfigSchema: z.ZodObject<{
779
1351
  providerName: z.ZodLiteral<"ollama">;
780
1352
  baseUrl: z.ZodOptional<z.ZodString>;
781
1353
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
782
1354
  }, z.core.$strip>;
783
- type OllamaProviderConfig = z.infer<typeof ollamaProviderConfigSchema>;
1355
+ /** Azure OpenAI provider configuration */
1356
+ interface AzureOpenAiProviderConfig {
1357
+ providerName: "azure-openai";
1358
+ /** API key for Azure */
1359
+ apiKey: string;
1360
+ /** Azure resource name */
1361
+ resourceName?: string;
1362
+ /** API version */
1363
+ apiVersion?: string;
1364
+ /** Custom base URL */
1365
+ baseUrl?: string;
1366
+ /** Custom headers */
1367
+ headers?: Headers;
1368
+ /** Use deployment-based URLs */
1369
+ useDeploymentBasedUrls?: boolean;
1370
+ }
784
1371
  declare const azureOpenAiProviderConfigSchema: z.ZodObject<{
785
1372
  providerName: z.ZodLiteral<"azure-openai">;
786
1373
  apiKey: z.ZodString;
@@ -790,7 +1377,18 @@ declare const azureOpenAiProviderConfigSchema: z.ZodObject<{
790
1377
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
791
1378
  useDeploymentBasedUrls: z.ZodOptional<z.ZodBoolean>;
792
1379
  }, z.core.$strip>;
793
- type AzureOpenAiProviderConfig = z.infer<typeof azureOpenAiProviderConfigSchema>;
1380
+ /** Amazon Bedrock provider configuration */
1381
+ interface AmazonBedrockProviderConfig {
1382
+ providerName: "amazon-bedrock";
1383
+ /** AWS access key ID */
1384
+ accessKeyId: string;
1385
+ /** AWS secret access key */
1386
+ secretAccessKey: string;
1387
+ /** AWS region */
1388
+ region: string;
1389
+ /** AWS session token (for temporary credentials) */
1390
+ sessionToken?: string;
1391
+ }
794
1392
  declare const amazonBedrockProviderConfigSchema: z.ZodObject<{
795
1393
  providerName: z.ZodLiteral<"amazon-bedrock">;
796
1394
  accessKeyId: z.ZodString;
@@ -798,7 +1396,18 @@ declare const amazonBedrockProviderConfigSchema: z.ZodObject<{
798
1396
  region: z.ZodString;
799
1397
  sessionToken: z.ZodOptional<z.ZodString>;
800
1398
  }, z.core.$strip>;
801
- type AmazonBedrockProviderConfig = z.infer<typeof amazonBedrockProviderConfigSchema>;
1399
+ /** Google Vertex AI provider configuration */
1400
+ interface GoogleVertexProviderConfig {
1401
+ providerName: "google-vertex";
1402
+ /** GCP project ID */
1403
+ project?: string;
1404
+ /** GCP location */
1405
+ location?: string;
1406
+ /** Custom base URL */
1407
+ baseUrl?: string;
1408
+ /** Custom headers */
1409
+ headers?: Headers;
1410
+ }
802
1411
  declare const googleVertexProviderConfigSchema: z.ZodObject<{
803
1412
  providerName: z.ZodLiteral<"google-vertex">;
804
1413
  project: z.ZodOptional<z.ZodString>;
@@ -806,7 +1415,24 @@ declare const googleVertexProviderConfigSchema: z.ZodObject<{
806
1415
  baseUrl: z.ZodOptional<z.ZodString>;
807
1416
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
808
1417
  }, z.core.$strip>;
809
- type GoogleVertexProviderConfig = z.infer<typeof googleVertexProviderConfigSchema>;
1418
+ /** DeepSeek provider configuration */
1419
+ interface DeepseekProviderConfig {
1420
+ providerName: "deepseek";
1421
+ /** API key for DeepSeek */
1422
+ apiKey: string;
1423
+ /** Custom base URL */
1424
+ baseUrl?: string;
1425
+ /** Custom headers */
1426
+ headers?: Headers;
1427
+ }
1428
+ declare const deepseekProviderConfigSchema: z.ZodObject<{
1429
+ providerName: z.ZodLiteral<"deepseek">;
1430
+ apiKey: z.ZodString;
1431
+ baseUrl: z.ZodOptional<z.ZodString>;
1432
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1433
+ }, z.core.$strip>;
1434
+ /** Union of all provider configurations */
1435
+ type ProviderConfig = AnthropicProviderConfig | GoogleGenerativeAiProviderConfig | OpenAiProviderConfig | OllamaProviderConfig | AzureOpenAiProviderConfig | AmazonBedrockProviderConfig | GoogleVertexProviderConfig | DeepseekProviderConfig;
810
1436
  declare const providerConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
811
1437
  providerName: z.ZodLiteral<"anthropic">;
812
1438
  apiKey: z.ZodString;
@@ -849,9 +1475,53 @@ declare const providerConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
849
1475
  location: z.ZodOptional<z.ZodString>;
850
1476
  baseUrl: z.ZodOptional<z.ZodString>;
851
1477
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1478
+ }, z.core.$strip>, z.ZodObject<{
1479
+ providerName: z.ZodLiteral<"deepseek">;
1480
+ apiKey: z.ZodString;
1481
+ baseUrl: z.ZodOptional<z.ZodString>;
1482
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
852
1483
  }, z.core.$strip>], "providerName">;
853
- type ProviderConfig = z.infer<typeof providerConfigSchema>;
854
1484
 
1485
+ /** Parsed command options after transformation */
1486
+ interface CommandOptions {
1487
+ /** Path to perstack.toml config file */
1488
+ config?: string;
1489
+ /** LLM provider to use */
1490
+ provider?: ProviderName;
1491
+ /** Model name */
1492
+ model?: string;
1493
+ /** Temperature (0-1) */
1494
+ temperature?: number;
1495
+ /** Maximum steps */
1496
+ maxSteps?: number;
1497
+ /** Maximum retries */
1498
+ maxRetries?: number;
1499
+ /** Timeout in milliseconds */
1500
+ timeout?: number;
1501
+ /** Custom run ID */
1502
+ runId?: string;
1503
+ /** Paths to .env files */
1504
+ envPath?: string[];
1505
+ /** Enable verbose logging */
1506
+ verbose?: boolean;
1507
+ /** Continue most recent run */
1508
+ continue?: boolean;
1509
+ /** Continue specific run by ID */
1510
+ continueRun?: string;
1511
+ /** Resume from specific checkpoint */
1512
+ resumeFrom?: string;
1513
+ /** Query is interactive tool call result */
1514
+ interactiveToolCallResult?: boolean;
1515
+ }
1516
+ /** Input for the `perstack run` command */
1517
+ interface RunCommandInput {
1518
+ /** Expert key to run */
1519
+ expertKey: string;
1520
+ /** Query or prompt */
1521
+ query: string;
1522
+ /** Command options */
1523
+ options: CommandOptions;
1524
+ }
855
1525
  declare const runCommandInputSchema: z.ZodObject<{
856
1526
  expertKey: z.ZodString;
857
1527
  query: z.ZodString;
@@ -861,6 +1531,7 @@ declare const runCommandInputSchema: z.ZodObject<{
861
1531
  anthropic: "anthropic";
862
1532
  google: "google";
863
1533
  openai: "openai";
1534
+ deepseek: "deepseek";
864
1535
  ollama: "ollama";
865
1536
  "azure-openai": "azure-openai";
866
1537
  "amazon-bedrock": "amazon-bedrock";
@@ -880,7 +1551,15 @@ declare const runCommandInputSchema: z.ZodObject<{
880
1551
  interactiveToolCallResult: z.ZodOptional<z.ZodBoolean>;
881
1552
  }, z.core.$strip>;
882
1553
  }, z.core.$strip>;
883
- type RunCommandInput = z.infer<typeof runCommandInputSchema>;
1554
+ /** Input for the `perstack start` command */
1555
+ interface StartCommandInput {
1556
+ /** Expert key to run (optional, prompts if not provided) */
1557
+ expertKey?: string;
1558
+ /** Query or prompt (optional, prompts if not provided) */
1559
+ query?: string;
1560
+ /** Command options */
1561
+ options: CommandOptions;
1562
+ }
884
1563
  declare const startCommandInputSchema: z.ZodObject<{
885
1564
  expertKey: z.ZodOptional<z.ZodString>;
886
1565
  query: z.ZodOptional<z.ZodString>;
@@ -890,6 +1569,7 @@ declare const startCommandInputSchema: z.ZodObject<{
890
1569
  anthropic: "anthropic";
891
1570
  google: "google";
892
1571
  openai: "openai";
1572
+ deepseek: "deepseek";
893
1573
  ollama: "ollama";
894
1574
  "azure-openai": "azure-openai";
895
1575
  "amazon-bedrock": "amazon-bedrock";
@@ -909,8 +1589,121 @@ declare const startCommandInputSchema: z.ZodObject<{
909
1589
  interactiveToolCallResult: z.ZodOptional<z.ZodBoolean>;
910
1590
  }, z.core.$strip>;
911
1591
  }, z.core.$strip>;
912
- type StartCommandInput = z.infer<typeof startCommandInputSchema>;
913
1592
 
1593
+ /** A tool call made by an Expert during execution */
1594
+ interface ToolCall {
1595
+ /** Unique identifier for this tool call */
1596
+ id: string;
1597
+ /** Name of the skill providing the tool */
1598
+ skillName: string;
1599
+ /** Name of the tool being called */
1600
+ toolName: string;
1601
+ /** Arguments passed to the tool */
1602
+ args: Record<string, unknown>;
1603
+ }
1604
+ declare const toolCallSchema: z.ZodObject<{
1605
+ id: z.ZodString;
1606
+ skillName: z.ZodString;
1607
+ toolName: z.ZodString;
1608
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1609
+ }, z.core.$strip>;
1610
+
1611
+ /** Result returned from a tool call */
1612
+ interface ToolResult {
1613
+ /** Unique identifier for this result */
1614
+ id: string;
1615
+ /** Name of the skill that provided the tool */
1616
+ skillName: string;
1617
+ /** Name of the tool that was called */
1618
+ toolName: string;
1619
+ /** Content parts returned by the tool */
1620
+ result: MessagePart[];
1621
+ }
1622
+ declare const toolResultSchema: z.ZodObject<{
1623
+ id: z.ZodString;
1624
+ skillName: z.ZodString;
1625
+ toolName: z.ZodString;
1626
+ result: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1627
+ id: z.ZodString;
1628
+ type: z.ZodLiteral<"textPart">;
1629
+ text: z.ZodString;
1630
+ }, z.core.$strip>, z.ZodObject<{
1631
+ id: z.ZodString;
1632
+ type: z.ZodLiteral<"imageUrlPart">;
1633
+ url: z.ZodURL;
1634
+ mimeType: z.ZodString;
1635
+ }, z.core.$strip>, z.ZodObject<{
1636
+ id: z.ZodString;
1637
+ type: z.ZodLiteral<"imageInlinePart">;
1638
+ encodedData: z.ZodString;
1639
+ mimeType: z.ZodString;
1640
+ }, z.core.$strip>, z.ZodObject<{
1641
+ id: z.ZodString;
1642
+ type: z.ZodLiteral<"imageBinaryPart">;
1643
+ data: z.ZodString;
1644
+ mimeType: z.ZodString;
1645
+ }, z.core.$strip>, z.ZodObject<{
1646
+ id: z.ZodString;
1647
+ type: z.ZodLiteral<"fileUrlPart">;
1648
+ url: z.ZodString;
1649
+ mimeType: z.ZodString;
1650
+ }, z.core.$strip>, z.ZodObject<{
1651
+ id: z.ZodString;
1652
+ type: z.ZodLiteral<"fileInlinePart">;
1653
+ encodedData: z.ZodString;
1654
+ mimeType: z.ZodString;
1655
+ }, z.core.$strip>, z.ZodObject<{
1656
+ id: z.ZodString;
1657
+ type: z.ZodLiteral<"fileBinaryPart">;
1658
+ data: z.ZodString;
1659
+ mimeType: z.ZodString;
1660
+ }, z.core.$strip>, z.ZodObject<{
1661
+ id: z.ZodString;
1662
+ type: z.ZodLiteral<"toolCallPart">;
1663
+ toolCallId: z.ZodString;
1664
+ toolName: z.ZodString;
1665
+ args: z.ZodUnknown;
1666
+ }, z.core.$strip>, z.ZodObject<{
1667
+ id: z.ZodString;
1668
+ type: z.ZodLiteral<"toolResultPart">;
1669
+ toolCallId: z.ZodString;
1670
+ toolName: z.ZodString;
1671
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1672
+ id: z.ZodString;
1673
+ type: z.ZodLiteral<"textPart">;
1674
+ text: z.ZodString;
1675
+ }, z.core.$strip>, z.ZodObject<{
1676
+ id: z.ZodString;
1677
+ type: z.ZodLiteral<"imageInlinePart">;
1678
+ encodedData: z.ZodString;
1679
+ mimeType: z.ZodString;
1680
+ }, z.core.$strip>]>>;
1681
+ isError: z.ZodOptional<z.ZodBoolean>;
1682
+ }, z.core.$strip>], "type">>;
1683
+ }, z.core.$strip>;
1684
+
1685
+ /**
1686
+ * A single execution step in an Expert run.
1687
+ * Each step represents one LLM generation cycle, optionally followed by a tool call.
1688
+ */
1689
+ interface Step {
1690
+ /** Sequential step number (1-indexed) */
1691
+ stepNumber: number;
1692
+ /** Messages sent to the LLM for this step */
1693
+ inputMessages?: (InstructionMessage | UserMessage | ToolMessage)[];
1694
+ /** Messages generated during this step */
1695
+ newMessages: Message[];
1696
+ /** Tool call made during this step, if any */
1697
+ toolCall?: ToolCall;
1698
+ /** Result of the tool call, if any */
1699
+ toolResult?: ToolResult;
1700
+ /** Token usage for this step */
1701
+ usage: Usage;
1702
+ /** Unix timestamp (ms) when step started */
1703
+ startedAt: number;
1704
+ /** Unix timestamp (ms) when step finished */
1705
+ finishedAt?: number;
1706
+ }
914
1707
  declare const stepSchema: z.ZodObject<{
915
1708
  stepNumber: z.ZodNumber;
916
1709
  inputMessages: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
@@ -1146,95 +1939,99 @@ declare const stepSchema: z.ZodObject<{
1146
1939
  startedAt: z.ZodNumber;
1147
1940
  finishedAt: z.ZodOptional<z.ZodNumber>;
1148
1941
  }, z.core.$strip>;
1149
- type Step = z.infer<typeof stepSchema>;
1150
-
1151
- declare const toolCallSchema: z.ZodObject<{
1152
- id: z.ZodString;
1153
- skillName: z.ZodString;
1154
- toolName: z.ZodString;
1155
- args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1156
- }, z.core.$strip>;
1157
- type ToolCall = z.infer<typeof toolCallSchema>;
1158
-
1159
- declare const toolResultSchema: z.ZodObject<{
1160
- id: z.ZodString;
1161
- skillName: z.ZodString;
1162
- toolName: z.ZodString;
1163
- result: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1164
- id: z.ZodString;
1165
- type: z.ZodLiteral<"textPart">;
1166
- text: z.ZodString;
1167
- }, z.core.$strip>, z.ZodObject<{
1168
- id: z.ZodString;
1169
- type: z.ZodLiteral<"imageUrlPart">;
1170
- url: z.ZodURL;
1171
- mimeType: z.ZodString;
1172
- }, z.core.$strip>, z.ZodObject<{
1173
- id: z.ZodString;
1174
- type: z.ZodLiteral<"imageInlinePart">;
1175
- encodedData: z.ZodString;
1176
- mimeType: z.ZodString;
1177
- }, z.core.$strip>, z.ZodObject<{
1178
- id: z.ZodString;
1179
- type: z.ZodLiteral<"imageBinaryPart">;
1180
- data: z.ZodString;
1181
- mimeType: z.ZodString;
1182
- }, z.core.$strip>, z.ZodObject<{
1183
- id: z.ZodString;
1184
- type: z.ZodLiteral<"fileUrlPart">;
1185
- url: z.ZodString;
1186
- mimeType: z.ZodString;
1187
- }, z.core.$strip>, z.ZodObject<{
1188
- id: z.ZodString;
1189
- type: z.ZodLiteral<"fileInlinePart">;
1190
- encodedData: z.ZodString;
1191
- mimeType: z.ZodString;
1192
- }, z.core.$strip>, z.ZodObject<{
1193
- id: z.ZodString;
1194
- type: z.ZodLiteral<"fileBinaryPart">;
1195
- data: z.ZodString;
1196
- mimeType: z.ZodString;
1197
- }, z.core.$strip>, z.ZodObject<{
1198
- id: z.ZodString;
1199
- type: z.ZodLiteral<"toolCallPart">;
1200
- toolCallId: z.ZodString;
1201
- toolName: z.ZodString;
1202
- args: z.ZodUnknown;
1203
- }, z.core.$strip>, z.ZodObject<{
1204
- id: z.ZodString;
1205
- type: z.ZodLiteral<"toolResultPart">;
1206
- toolCallId: z.ZodString;
1207
- toolName: z.ZodString;
1208
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1209
- id: z.ZodString;
1210
- type: z.ZodLiteral<"textPart">;
1211
- text: z.ZodString;
1212
- }, z.core.$strip>, z.ZodObject<{
1213
- id: z.ZodString;
1214
- type: z.ZodLiteral<"imageInlinePart">;
1215
- encodedData: z.ZodString;
1216
- mimeType: z.ZodString;
1217
- }, z.core.$strip>]>>;
1218
- isError: z.ZodOptional<z.ZodBoolean>;
1219
- }, z.core.$strip>], "type">>;
1220
- }, z.core.$strip>;
1221
- type ToolResult = z.infer<typeof toolResultSchema>;
1222
-
1223
- declare const usageSchema: z.ZodObject<{
1224
- inputTokens: z.ZodNumber;
1225
- outputTokens: z.ZodNumber;
1226
- reasoningTokens: z.ZodNumber;
1227
- totalTokens: z.ZodNumber;
1228
- cachedInputTokens: z.ZodNumber;
1229
- }, z.core.$strip>;
1230
- type Usage = z.infer<typeof usageSchema>;
1231
1942
 
1943
+ /** Parse an expert key into its components */
1232
1944
  declare function parseExpertKey(expertKey: string): {
1233
1945
  key: string;
1234
1946
  name: string;
1235
1947
  version?: string;
1236
1948
  tag?: string;
1237
1949
  };
1950
+ /** Input for a run (text or interactive tool call result) */
1951
+ interface RunInput {
1952
+ /** Text query */
1953
+ text?: string;
1954
+ /** Interactive tool call result (when continuing from interactive tool) */
1955
+ interactiveToolCallResult?: {
1956
+ toolCallId: string;
1957
+ toolName: string;
1958
+ text: string;
1959
+ };
1960
+ }
1961
+ /** Runtime settings for an Expert run */
1962
+ interface RunSetting {
1963
+ /** Model name to use */
1964
+ model: string;
1965
+ /** Provider configuration */
1966
+ providerConfig: ProviderConfig;
1967
+ /** Unique run identifier */
1968
+ runId: string;
1969
+ /** Expert key to run */
1970
+ expertKey: string;
1971
+ /** Input for the run */
1972
+ input: RunInput;
1973
+ /** Map of expert keys to Expert definitions */
1974
+ experts: Record<string, Expert>;
1975
+ /** Temperature for generation (0-1) */
1976
+ temperature: number;
1977
+ /** Maximum steps before stopping */
1978
+ maxSteps?: number;
1979
+ /** Maximum retries on generation failure */
1980
+ maxRetries: number;
1981
+ /** Timeout per generation in milliseconds */
1982
+ timeout: number;
1983
+ /** Unix timestamp when run started */
1984
+ startedAt: number;
1985
+ /** Unix timestamp of last update */
1986
+ updatedAt: number;
1987
+ /** Perstack API base URL */
1988
+ perstackApiBaseUrl: string;
1989
+ /** Perstack API key */
1990
+ perstackApiKey?: string;
1991
+ /** Custom command for @perstack/base */
1992
+ perstackBaseSkillCommand?: string[];
1993
+ /** Environment variables to pass to skills */
1994
+ env: Record<string, string>;
1995
+ }
1996
+ /** Parameters for starting a run */
1997
+ interface RunParams {
1998
+ /** Run settings */
1999
+ setting: RunSetting;
2000
+ /** Optional checkpoint to resume from */
2001
+ checkpoint?: Checkpoint;
2002
+ }
2003
+ /** Expert input type before schema transformation (skills without name, optional fields) */
2004
+ type ExpertInput = {
2005
+ name: string;
2006
+ version: string;
2007
+ description?: string;
2008
+ instruction: string;
2009
+ skills?: Record<string, PerstackConfigSkill>;
2010
+ delegates?: string[];
2011
+ tags?: string[];
2012
+ };
2013
+ /** Input type for runParamsSchema (before defaults/transforms) */
2014
+ type RunParamsInput = {
2015
+ setting: {
2016
+ model: string;
2017
+ providerConfig: ProviderConfig;
2018
+ runId?: string;
2019
+ expertKey: string;
2020
+ input: RunInput;
2021
+ experts?: Record<string, ExpertInput>;
2022
+ temperature?: number;
2023
+ maxSteps?: number;
2024
+ maxRetries?: number;
2025
+ timeout?: number;
2026
+ startedAt?: number;
2027
+ updatedAt?: number;
2028
+ perstackApiBaseUrl?: string;
2029
+ perstackApiKey?: string;
2030
+ perstackBaseSkillCommand?: string[];
2031
+ env?: Record<string, string>;
2032
+ };
2033
+ checkpoint?: Checkpoint;
2034
+ };
1238
2035
  declare const runParamsSchema: z.ZodObject<{
1239
2036
  setting: z.ZodObject<{
1240
2037
  model: z.ZodString;
@@ -1280,6 +2077,11 @@ declare const runParamsSchema: z.ZodObject<{
1280
2077
  location: z.ZodOptional<z.ZodString>;
1281
2078
  baseUrl: z.ZodOptional<z.ZodString>;
1282
2079
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2080
+ }, z.core.$strip>, z.ZodObject<{
2081
+ providerName: z.ZodLiteral<"deepseek">;
2082
+ apiKey: z.ZodString;
2083
+ baseUrl: z.ZodOptional<z.ZodString>;
2084
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1283
2085
  }, z.core.$strip>], "providerName">;
1284
2086
  runId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1285
2087
  expertKey: z.ZodString;
@@ -1292,14 +2094,14 @@ declare const runParamsSchema: z.ZodObject<{
1292
2094
  }, z.core.$strip>>;
1293
2095
  }, z.core.$strip>;
1294
2096
  experts: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
2097
+ description: z.ZodOptional<z.ZodString>;
1295
2098
  name: z.ZodString;
1296
2099
  version: z.ZodString;
1297
- description: z.ZodOptional<z.ZodString>;
1298
2100
  instruction: z.ZodString;
1299
2101
  skills: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
1300
2102
  type: z.ZodLiteral<"mcpStdioSkill">;
1301
- args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1302
2103
  description: z.ZodOptional<z.ZodString>;
2104
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1303
2105
  rule: z.ZodOptional<z.ZodString>;
1304
2106
  pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1305
2107
  omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
@@ -1489,7 +2291,6 @@ declare const runParamsSchema: z.ZodObject<{
1489
2291
  maxSteps: z.ZodOptional<z.ZodNumber>;
1490
2292
  maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1491
2293
  timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1492
- workspace: z.ZodOptional<z.ZodString>;
1493
2294
  startedAt: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1494
2295
  updatedAt: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1495
2296
  perstackApiBaseUrl: z.ZodDefault<z.ZodOptional<z.ZodURL>>;
@@ -1631,15 +2432,9 @@ declare const runParamsSchema: z.ZodObject<{
1631
2432
  contextWindowUsage: z.ZodOptional<z.ZodNumber>;
1632
2433
  }, z.core.$strip>>;
1633
2434
  }, z.core.$strip>;
1634
- type RunParamsInput = z.input<typeof runParamsSchema>;
1635
- type RunParams = z.output<typeof runParamsSchema>;
1636
- type RunSetting = z.infer<typeof runParamsSchema.shape.setting>;
1637
- type RunInput = z.infer<typeof runParamsSchema.shape.setting.shape.input>;
1638
2435
  /**
1639
- * ExpertEvents can only contain deeply serializable properties.
1640
- * This is important because these events are serialized using JSON.stringify() and stored in Cassandra,
1641
- * and later used to restore state when resuming execution. Non-serializable properties would cause
1642
- * issues during serialization/deserialization process.
2436
+ * Expert run events - emitted during execution for observability.
2437
+ * All events contain deeply serializable properties for checkpoint storage.
1643
2438
  */
1644
2439
  type ExpertEventPayloads = {
1645
2440
  startRun: {
@@ -1713,22 +2508,32 @@ type ExpertEventPayloads = {
1713
2508
  usage: Usage;
1714
2509
  };
1715
2510
  };
1716
- type BaseEvent = {
2511
+ /** Base properties for all run events */
2512
+ interface BaseEvent {
2513
+ /** Unique event ID */
1717
2514
  id: string;
2515
+ /** Expert key that emitted this event */
1718
2516
  expertKey: string;
2517
+ /** Unix timestamp when event was emitted */
1719
2518
  timestamp: number;
2519
+ /** Run ID this event belongs to */
1720
2520
  runId: string;
2521
+ /** Step number when event was emitted */
1721
2522
  stepNumber: number;
1722
- };
2523
+ }
2524
+ /** All possible event types */
1723
2525
  type EventType = keyof ExpertEventPayloads;
2526
+ /** Union type of all run events */
1724
2527
  type RunEvent = {
1725
2528
  [K in EventType]: BaseEvent & {
1726
2529
  type: K;
1727
2530
  } & ExpertEventPayloads[K];
1728
2531
  }[EventType];
2532
+ /** Extract a specific event type */
1729
2533
  type EventForType<T extends EventType> = Extract<RunEvent, {
1730
2534
  type: T;
1731
2535
  }>;
2536
+ /** Factory function to create typed events */
1732
2537
  declare function createEvent<T extends EventType>(type: T): (setting: RunSetting, checkpoint: Checkpoint, data: Omit<EventForType<T>, "type" | "id" | "expertKey" | "timestamp" | "runId" | "stepNumber">) => EventForType<T>;
1733
2538
  declare const startRun: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1734
2539
  type: "startRun";
@@ -1921,11 +2726,16 @@ declare const continueToNextStep: (setting: RunSetting, checkpoint: Checkpoint,
1921
2726
  step: Step;
1922
2727
  nextCheckpoint: Checkpoint;
1923
2728
  };
1924
- type BaseRuntimeEvent = {
2729
+ /** Base properties for runtime events */
2730
+ interface BaseRuntimeEvent {
2731
+ /** Unique event ID */
1925
2732
  id: string;
2733
+ /** Unix timestamp */
1926
2734
  timestamp: number;
2735
+ /** Run ID */
1927
2736
  runId: string;
1928
- };
2737
+ }
2738
+ /** Runtime event payloads (infrastructure-level events) */
1929
2739
  type RuntimeEventPayloads = {
1930
2740
  initializeRuntime: {
1931
2741
  runtimeVersion: string;
@@ -1954,152 +2764,84 @@ type RuntimeEventPayloads = {
1954
2764
  skillName: string;
1955
2765
  };
1956
2766
  };
2767
+ /** All runtime event types */
1957
2768
  type RuntimeEventType = keyof RuntimeEventPayloads;
2769
+ /** Union type of all runtime events */
1958
2770
  type RuntimeEvent = {
1959
2771
  [K in RuntimeEventType]: BaseRuntimeEvent & {
1960
2772
  type: K;
1961
2773
  } & RuntimeEventPayloads[K];
1962
2774
  }[RuntimeEventType];
2775
+ /** Extract a specific runtime event type */
1963
2776
  type RuntimeEventForType<T extends RuntimeEventType> = Extract<RuntimeEvent, {
1964
2777
  type: T;
1965
2778
  }>;
2779
+ /** Factory function to create runtime events */
1966
2780
  declare function createRuntimeEvent<T extends RuntimeEventType>(type: T, runId: string, data: Omit<RuntimeEventForType<T>, "type" | "id" | "timestamp" | "runId">): RuntimeEventForType<T>;
1967
2781
 
1968
- declare const mcpStdioSkillSchema: z.ZodObject<{
1969
- type: z.ZodLiteral<"mcpStdioSkill">;
1970
- name: z.ZodString;
1971
- description: z.ZodOptional<z.ZodString>;
1972
- rule: z.ZodOptional<z.ZodString>;
1973
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1974
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1975
- command: z.ZodString;
1976
- packageName: z.ZodOptional<z.ZodString>;
1977
- args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1978
- requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1979
- lazyInit: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1980
- }, z.core.$strip>;
1981
- type McpStdioSkill = z.infer<typeof mcpStdioSkillSchema>;
1982
- declare const mcpSseSkillSchema: z.ZodObject<{
1983
- type: z.ZodLiteral<"mcpSseSkill">;
1984
- name: z.ZodString;
1985
- description: z.ZodOptional<z.ZodString>;
1986
- rule: z.ZodOptional<z.ZodString>;
1987
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1988
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1989
- endpoint: z.ZodString;
1990
- }, z.core.$strip>;
1991
- type McpSseSkill = z.infer<typeof mcpSseSkillSchema>;
1992
- declare const interactiveToolSchema: z.ZodObject<{
1993
- name: z.ZodString;
1994
- description: z.ZodOptional<z.ZodString>;
1995
- inputJsonSchema: z.ZodString;
1996
- }, z.core.$strip>;
1997
- type InteractiveTool = z.infer<typeof interactiveToolSchema>;
1998
- declare const interactiveSkillSchema: z.ZodObject<{
1999
- type: z.ZodLiteral<"interactiveSkill">;
2000
- name: z.ZodString;
2001
- description: z.ZodOptional<z.ZodString>;
2002
- rule: z.ZodOptional<z.ZodString>;
2003
- tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
2004
- description: z.ZodOptional<z.ZodString>;
2005
- inputJsonSchema: z.ZodString;
2006
- }, z.core.$strip>>, z.ZodTransform<{
2007
- [k: string]: {
2008
- name: string;
2009
- inputJsonSchema: string;
2010
- description?: string | undefined;
2011
- };
2012
- }, Record<string, {
2013
- inputJsonSchema: string;
2014
- description?: string | undefined;
2015
- }>>>;
2016
- }, z.core.$strip>;
2017
- type InteractiveSkill = z.infer<typeof interactiveSkillSchema>;
2018
- declare const skillSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2019
- type: z.ZodLiteral<"mcpStdioSkill">;
2020
- name: z.ZodString;
2021
- description: z.ZodOptional<z.ZodString>;
2022
- rule: z.ZodOptional<z.ZodString>;
2023
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
2024
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
2025
- command: z.ZodString;
2026
- packageName: z.ZodOptional<z.ZodString>;
2027
- args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
2028
- requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
2029
- lazyInit: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2030
- }, z.core.$strip>, z.ZodObject<{
2031
- type: z.ZodLiteral<"mcpSseSkill">;
2032
- name: z.ZodString;
2033
- description: z.ZodOptional<z.ZodString>;
2034
- rule: z.ZodOptional<z.ZodString>;
2035
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
2036
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
2037
- endpoint: z.ZodString;
2038
- }, z.core.$strip>, z.ZodObject<{
2039
- type: z.ZodLiteral<"interactiveSkill">;
2040
- name: z.ZodString;
2041
- description: z.ZodOptional<z.ZodString>;
2042
- rule: z.ZodOptional<z.ZodString>;
2043
- tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
2044
- description: z.ZodOptional<z.ZodString>;
2045
- inputJsonSchema: z.ZodString;
2046
- }, z.core.$strip>>, z.ZodTransform<{
2047
- [k: string]: {
2048
- name: string;
2049
- inputJsonSchema: string;
2050
- description?: string | undefined;
2051
- };
2052
- }, Record<string, {
2053
- inputJsonSchema: string;
2054
- description?: string | undefined;
2055
- }>>>;
2056
- }, z.core.$strip>], "type">;
2057
- type Skill = z.infer<typeof skillSchema>;
2058
-
2782
+ /** Discriminator for skill manager types */
2059
2783
  type SkillType = "mcp" | "interactive" | "delegate";
2784
+ /** Parameters for initializing an MCP-based skill manager (stdio or SSE) */
2060
2785
  interface McpSkillManagerParams {
2061
2786
  type: "mcp";
2787
+ /** MCP skill configuration */
2062
2788
  skill: McpStdioSkill | McpSseSkill;
2789
+ /** Environment variables to pass to the MCP server */
2063
2790
  env: Record<string, string>;
2064
2791
  }
2792
+ /** Parameters for initializing an interactive skill manager */
2065
2793
  interface InteractiveSkillManagerParams {
2066
2794
  type: "interactive";
2795
+ /** Interactive skill configuration */
2067
2796
  interactiveSkill: InteractiveSkill;
2068
2797
  }
2798
+ /** Parameters for initializing a delegate skill manager */
2069
2799
  interface DelegateSkillManagerParams {
2070
2800
  type: "delegate";
2801
+ /** Expert to delegate to */
2071
2802
  expert: Expert;
2072
2803
  }
2804
+ /** Union type for all skill manager initialization parameters */
2073
2805
  type SkillManagerParams = McpSkillManagerParams | InteractiveSkillManagerParams | DelegateSkillManagerParams;
2806
+ /** Definition of a tool exposed by a skill manager */
2074
2807
  interface ToolDefinition {
2808
+ /** Name of the skill providing this tool */
2075
2809
  skillName: string;
2810
+ /** Tool name */
2076
2811
  name: string;
2812
+ /** Human-readable description */
2077
2813
  description?: string;
2814
+ /** JSON Schema for tool input */
2078
2815
  inputSchema: {
2079
2816
  [k: string]: unknown;
2080
2817
  };
2818
+ /** Whether this tool requires human interaction */
2081
2819
  interactive: boolean;
2082
2820
  }
2821
+ /** Content returned from a tool call */
2083
2822
  type CallToolResultContent = {
2823
+ /** Content type */
2084
2824
  type: "text" | "image" | "resource";
2825
+ /** Text content (when type is "text") */
2085
2826
  text?: string;
2827
+ /** Base64-encoded data (when type is "image") */
2086
2828
  data?: string;
2829
+ /** MIME type of the content */
2087
2830
  mimeType?: string;
2831
+ /** Resource reference (when type is "resource") */
2088
2832
  resource?: Resource;
2089
2833
  };
2834
+ /** MCP resource reference */
2090
2835
  type Resource = {
2836
+ /** MIME type of the resource */
2091
2837
  mimeType?: string;
2838
+ /** Text content */
2092
2839
  text?: string;
2840
+ /** Base64-encoded binary content */
2093
2841
  blob?: string;
2094
2842
  };
2095
2843
 
2096
- declare const knownModels: {
2097
- provider: string;
2098
- models: {
2099
- name: string;
2100
- contextWindow: number;
2101
- maxOutputTokens: number;
2102
- }[];
2103
- }[];
2844
+ declare function formatZodError(error: ZodError): string;
2845
+ declare function parseWithFriendlyError<T>(schema: ZodSchema<T>, data: unknown, context?: string): T;
2104
2846
 
2105
- export { type AmazonBedrockProviderConfig, type AnthropicProviderConfig, type AzureOpenAiProviderConfig, type BasePart, type CallToolResultContent, type Checkpoint, type CheckpointStatus, type DelegateSkillManagerParams, type EventForType, type EventType, type Expert, type ExpertMessage, type FileBinaryPart, type FileInlinePart, type FileUrlPart, type GoogleGenerativeAiProviderConfig, type GoogleVertexProviderConfig, type ImageBinaryPart, type ImageInlinePart, type ImageUrlPart, type InstructionMessage, type InteractiveSkill, type InteractiveSkillManagerParams, type InteractiveTool, type McpSkillManagerParams, type McpSseSkill, type McpStdioSkill, type Message, type MessagePart, type OllamaProviderConfig, type OpenAiProviderConfig, type PerstackConfig, type ProviderConfig, type ProviderName, type ProviderTable, type Resource, type RunCommandInput, type RunEvent, type RunInput, type RunParams, type RunParamsInput, type RunSetting, type RuntimeEvent, type RuntimeEventForType, type RuntimeEventType, type Skill, type SkillManagerParams, type SkillType, type StartCommandInput, type Step, type TextPart, type ToolCall, type ToolCallPart, type ToolDefinition, type ToolMessage, type ToolResult, type ToolResultPart, type Usage, type UserMessage, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, attemptCompletion, azureOpenAiProviderConfigSchema, basePartSchema, callDelegate, callInteractiveTool, callTool, checkpointSchema, checkpointStatusSchema, completeRun, continueToNextStep, createEvent, createRuntimeEvent, defaultMaxRetries, defaultMaxSteps, defaultPerstackApiBaseUrl, defaultTemperature, defaultTimeout, envNameRegex, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileUrlPartSchema, finishToolCall, googleGenerativeAiProviderConfigSchema, googleVertexProviderConfigSchema, headersSchema, 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, providerTableSchema, resolveImageFile, resolvePdfFile, resolveThought, resolveToolResult, retry, runCommandInputSchema, runParamsSchema, skillSchema, startCommandInputSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, textPartSchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, urlSafeRegex, usageSchema, userMessageSchema };
2847
+ export { type AmazonBedrockProviderConfig, type AnthropicProviderConfig, type AzureOpenAiProviderConfig, type BaseEvent, type BasePart, type CallToolResultContent, type Checkpoint, type CheckpointStatus, type CommandOptions, type DeepseekProviderConfig, type DelegateSkillManagerParams, type EventForType, type EventType, type Expert, type ExpertMessage, type FileBinaryPart, type FileInlinePart, type FileUrlPart, type GoogleGenerativeAiProviderConfig, type GoogleVertexProviderConfig, type Headers, type ImageBinaryPart, type ImageInlinePart, type ImageUrlPart, type InstructionMessage, type InteractiveSkill, type InteractiveSkillManagerParams, type InteractiveTool, type McpSkillManagerParams, type McpSseSkill, type McpStdioSkill, type Message, type MessagePart, type OllamaProviderConfig, type OpenAiProviderConfig, type PerstackConfig, type PerstackConfigExpert, type PerstackConfigSkill, type ProviderConfig, type ProviderName, type ProviderTable, type Resource, type RunCommandInput, type RunEvent, type RunInput, type RunParams, type RunParamsInput, type RunSetting, type RuntimeEvent, type RuntimeEventForType, type RuntimeEventType, type Skill, type SkillManagerParams, type SkillType, type StartCommandInput, type Step, type TextPart, type ToolCall, type ToolCallPart, type ToolDefinition, type ToolMessage, type ToolResult, type ToolResultPart, type Usage, type UserMessage, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, attemptCompletion, azureOpenAiProviderConfigSchema, basePartSchema, callDelegate, callInteractiveTool, callTool, checkpointSchema, checkpointStatusSchema, completeRun, continueToNextStep, createEvent, createRuntimeEvent, deepseekProviderConfigSchema, defaultMaxRetries, defaultMaxSteps, defaultPerstackApiBaseUrl, defaultTemperature, defaultTimeout, envNameRegex, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileUrlPartSchema, finishToolCall, formatZodError, googleGenerativeAiProviderConfigSchema, googleVertexProviderConfigSchema, headersSchema, 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, parseWithFriendlyError, perstackConfigSchema, providerConfigSchema, providerNameSchema, providerTableSchema, resolveImageFile, resolvePdfFile, resolveThought, resolveToolResult, retry, runCommandInputSchema, runParamsSchema, skillSchema, startCommandInputSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, textPartSchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, urlSafeRegex, usageSchema, userMessageSchema };