@prompty/core 0.1.4 → 2.0.0-alpha.3

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.
@@ -0,0 +1,2327 @@
1
+ /**
2
+ * Core message types for the Prompty pipeline.
3
+ *
4
+ * These types are protocol-agnostic — they represent the abstract
5
+ * message format that executors translate to provider-specific
6
+ * wire formats (e.g., OpenAI JSON).
7
+ *
8
+ * @module
9
+ */
10
+ /** Base shape shared by all content parts. */
11
+ interface ContentPartBase {
12
+ kind: string;
13
+ }
14
+ /** Plain text content. */
15
+ interface TextPart extends ContentPartBase {
16
+ kind: "text";
17
+ value: string;
18
+ }
19
+ /** Image reference (URL or base64 data URI). */
20
+ interface ImagePart extends ContentPartBase {
21
+ kind: "image";
22
+ source: string;
23
+ detail?: string;
24
+ mediaType?: string;
25
+ }
26
+ /** File reference. */
27
+ interface FilePart extends ContentPartBase {
28
+ kind: "file";
29
+ source: string;
30
+ mediaType?: string;
31
+ }
32
+ /** Audio reference (URL or base64 data URI). */
33
+ interface AudioPart extends ContentPartBase {
34
+ kind: "audio";
35
+ source: string;
36
+ mediaType?: string;
37
+ }
38
+ /** Discriminated union of all content part types. */
39
+ type ContentPart = TextPart | ImagePart | FilePart | AudioPart;
40
+ /** Valid message roles. */
41
+ type Role = "system" | "user" | "assistant" | "developer" | "tool";
42
+ /**
43
+ * An abstract message in the Prompty pipeline.
44
+ *
45
+ * Executors convert this to provider-specific wire format.
46
+ * Parsers produce this from rendered template text.
47
+ */
48
+ declare class Message {
49
+ role: Role;
50
+ parts: ContentPart[];
51
+ metadata: Record<string, unknown>;
52
+ constructor(role: Role, parts?: ContentPart[], metadata?: Record<string, unknown>);
53
+ /** Concatenate all TextPart values into a single string. */
54
+ get text(): string;
55
+ /**
56
+ * Return content in a format suitable for wire serialization:
57
+ * - If all parts are text, return a single string.
58
+ * - If multimodal, return an array of content objects.
59
+ */
60
+ toTextContent(): string | Record<string, unknown>[];
61
+ }
62
+ /**
63
+ * Positional marker for conversation history insertion.
64
+ *
65
+ * During `prepare()`, nonce strings in rendered text are replaced
66
+ * with ThreadMarker objects. Then `expandThreadMarkers()` replaces
67
+ * them with actual conversation messages from the inputs.
68
+ */
69
+ declare class ThreadMarker {
70
+ readonly name: string;
71
+ constructor(name: string);
72
+ }
73
+ /** Represents a tool call extracted from an LLM response. */
74
+ interface ToolCall {
75
+ id: string;
76
+ name: string;
77
+ arguments: string;
78
+ }
79
+ /**
80
+ * Input kinds that receive special handling in the pipeline
81
+ * (nonce-based substitution rather than direct template interpolation).
82
+ */
83
+ declare const RICH_KINDS: Set<string>;
84
+ /** Standard message roles. */
85
+ declare const ROLES: Set<Role>;
86
+ /**
87
+ * Tracing-aware wrapper for asynchronous LLM streaming responses.
88
+ *
89
+ * Accumulates all chunks as they are yielded. When the async iterator
90
+ * is exhausted, the accumulated items are flushed to the tracer.
91
+ *
92
+ * Matches the Python PromptyStream / AsyncPromptyStream pattern.
93
+ */
94
+ declare class PromptyStream implements AsyncIterable<unknown> {
95
+ readonly name: string;
96
+ private readonly inner;
97
+ readonly items: unknown[];
98
+ constructor(name: string, inner: AsyncIterable<unknown>);
99
+ [Symbol.asyncIterator](): AsyncIterableIterator<unknown>;
100
+ }
101
+ /** Create a TextPart. */
102
+ declare function text(value: string): TextPart;
103
+ /** Create a Message with a single text part. */
104
+ declare function textMessage(role: Role, value: string, metadata?: Record<string, unknown>): Message;
105
+ /** Convert a plain dict `{role, content, ...}` to a Message. */
106
+ declare function dictToMessage(d: Record<string, unknown>): Message;
107
+ /** Convert a content dict to a ContentPart. */
108
+ declare function dictContentToPart(d: Record<string, unknown>): ContentPart;
109
+
110
+ /**
111
+ * Context for customizing the loading process of agent definitions.
112
+ *
113
+ * Provides hooks for pre-processing input data before parsing and
114
+ * post-processing output data after instantiation.
115
+ */
116
+ declare class LoadContext {
117
+ /**
118
+ * Optional callback to transform input data before parsing.
119
+ */
120
+ preProcess?: (data: Record<string, unknown>) => Record<string, unknown>;
121
+ /**
122
+ * Optional callback to transform the result after instantiation.
123
+ */
124
+ postProcess?: (result: unknown) => unknown;
125
+ constructor(init?: Partial<LoadContext>);
126
+ /**
127
+ * Apply pre-processing to input data if a preProcess callback is set.
128
+ * @param data - The raw input dictionary to process.
129
+ * @returns The processed dictionary, or the original if no callback is set.
130
+ */
131
+ processInput(data: Record<string, unknown>): Record<string, unknown>;
132
+ /**
133
+ * Apply post-processing to the result if a postProcess callback is set.
134
+ * @param result - The instantiated object to process.
135
+ * @returns The processed result, or the original if no callback is set.
136
+ */
137
+ processOutput<T>(result: T): T;
138
+ }
139
+ /**
140
+ * Context for customizing the serialization process of agent definitions.
141
+ *
142
+ * Provides hooks for pre-processing the object before serialization and
143
+ * post-processing the dictionary after serialization.
144
+ */
145
+ declare class SaveContext {
146
+ /**
147
+ * Optional callback to transform the object before serialization.
148
+ */
149
+ preSave?: (obj: unknown) => unknown;
150
+ /**
151
+ * Optional callback to transform the dictionary after serialization.
152
+ */
153
+ postSave?: (data: Record<string, unknown>) => Record<string, unknown>;
154
+ /**
155
+ * Output format for collections: "object" (name as key) or "array" (list of dicts).
156
+ * Defaults to "object".
157
+ */
158
+ collectionFormat: "object" | "array";
159
+ /**
160
+ * Use shorthand scalar representation when possible.
161
+ * Defaults to true.
162
+ */
163
+ useShorthand: boolean;
164
+ constructor(init?: Partial<SaveContext>);
165
+ /**
166
+ * Apply pre-processing to the object if a preSave callback is set.
167
+ * @param obj - The object to process before serialization.
168
+ * @returns The processed object, or the original if no callback is set.
169
+ */
170
+ processObject<T>(obj: T): T;
171
+ /**
172
+ * Apply post-processing to the dictionary if a postSave callback is set.
173
+ * @param data - The serialized dictionary to process.
174
+ * @returns The processed dictionary, or the original if no callback is set.
175
+ */
176
+ processDict(data: Record<string, unknown>): Record<string, unknown>;
177
+ /**
178
+ * Convert a dictionary to a YAML string.
179
+ * @param data - The dictionary to convert.
180
+ * @returns The YAML string representation.
181
+ */
182
+ toYaml(data: Record<string, unknown>): string;
183
+ /**
184
+ * Convert a dictionary to a JSON string.
185
+ * @param data - The dictionary to convert.
186
+ * @param indent - Number of spaces for indentation.
187
+ * @returns The JSON string representation.
188
+ */
189
+ toJson(data: Record<string, unknown>, indent?: number): string;
190
+ }
191
+
192
+ /**
193
+ * Connection configuration for AI agents.
194
+ * `provider`, `kind`, and `endpoint` are required properties here,
195
+ * but this section can accept additional via options.
196
+ *
197
+ */
198
+ declare abstract class Connection {
199
+ /**
200
+ * The shorthand property name for this type, if any.
201
+ */
202
+ static readonly shorthandProperty: string | undefined;
203
+ /**
204
+ * The Authentication kind for the AI service (e.g., 'key' for API key, 'oauth' for OAuth tokens)
205
+ */
206
+ kind: string;
207
+ /**
208
+ * The authority level for the connection, indicating under whose authority the connection is made (e.g., 'user', 'agent', 'system')
209
+ */
210
+ authenticationMode: string;
211
+ /**
212
+ * The usage description for the connection, providing context on how this connection will be used
213
+ */
214
+ usageDescription?: string | undefined;
215
+ /**
216
+ * Initializes a new instance of Connection.
217
+ */
218
+ constructor(init?: Partial<Connection>);
219
+ /**
220
+ * Load a Connection instance from a dictionary.
221
+ * @param data - The dictionary containing the data.
222
+ * @param context - Optional context with pre/post processing callbacks.
223
+ * @returns The loaded Connection instance.
224
+ */
225
+ static load(data: Record<string, unknown>, context?: LoadContext): Connection;
226
+ /**
227
+ * Load polymorphic Connection based on discriminator.
228
+ * @param data - The dictionary containing the data.
229
+ * @param context - Optional context with pre/post processing callbacks.
230
+ * @returns The loaded Connection instance.
231
+ */
232
+ private static loadKind;
233
+ /**
234
+ * Save the Connection instance to a dictionary.
235
+ * @param context - Optional context with pre/post processing callbacks.
236
+ * @returns The dictionary representation of this instance.
237
+ */
238
+ save(context?: SaveContext): Record<string, unknown>;
239
+ /**
240
+ * Convert the Connection instance to a YAML string.
241
+ * @param context - Optional context with pre/post processing callbacks.
242
+ * @returns The YAML string representation of this instance.
243
+ */
244
+ toYaml(context?: SaveContext): string;
245
+ /**
246
+ * Convert the Connection instance to a JSON string.
247
+ * @param context - Optional context with pre/post processing callbacks.
248
+ * @param indent - Number of spaces for indentation. Defaults to 2.
249
+ * @returns The JSON string representation of this instance.
250
+ */
251
+ toJson(context?: SaveContext, indent?: number): string;
252
+ /**
253
+ * Load a Connection instance from a JSON string.
254
+ * @param json - The JSON string to parse.
255
+ * @param context - Optional context with pre/post processing callbacks.
256
+ * @returns The loaded Connection instance.
257
+ */
258
+ static fromJson(json: string, context?: LoadContext): Connection;
259
+ /**
260
+ * Load a Connection instance from a YAML string.
261
+ * @param yaml - The YAML string to parse.
262
+ * @param context - Optional context with pre/post processing callbacks.
263
+ * @returns The loaded Connection instance.
264
+ */
265
+ static fromYaml(yaml: string, context?: LoadContext): Connection;
266
+ }
267
+ /**
268
+ * Connection configuration for AI services using named connections.
269
+ *
270
+ */
271
+ declare class ReferenceConnection extends Connection {
272
+ /**
273
+ * The shorthand property name for this type, if any.
274
+ */
275
+ static readonly shorthandProperty: string | undefined;
276
+ /**
277
+ * The Authentication kind for the AI service (e.g., 'key' for API key, 'oauth' for OAuth tokens)
278
+ */
279
+ kind: string;
280
+ /**
281
+ * The name of the connection
282
+ */
283
+ name: string;
284
+ /**
285
+ * The target resource or service that this connection refers to
286
+ */
287
+ target?: string | undefined;
288
+ /**
289
+ * Initializes a new instance of ReferenceConnection.
290
+ */
291
+ constructor(init?: Partial<ReferenceConnection>);
292
+ /**
293
+ * Load a ReferenceConnection instance from a dictionary.
294
+ * @param data - The dictionary containing the data.
295
+ * @param context - Optional context with pre/post processing callbacks.
296
+ * @returns The loaded ReferenceConnection instance.
297
+ */
298
+ static load(data: Record<string, unknown>, context?: LoadContext): ReferenceConnection;
299
+ /**
300
+ * Save the ReferenceConnection instance to a dictionary.
301
+ * @param context - Optional context with pre/post processing callbacks.
302
+ * @returns The dictionary representation of this instance.
303
+ */
304
+ save(context?: SaveContext): Record<string, unknown>;
305
+ /**
306
+ * Convert the ReferenceConnection instance to a YAML string.
307
+ * @param context - Optional context with pre/post processing callbacks.
308
+ * @returns The YAML string representation of this instance.
309
+ */
310
+ toYaml(context?: SaveContext): string;
311
+ /**
312
+ * Convert the ReferenceConnection instance to a JSON string.
313
+ * @param context - Optional context with pre/post processing callbacks.
314
+ * @param indent - Number of spaces for indentation. Defaults to 2.
315
+ * @returns The JSON string representation of this instance.
316
+ */
317
+ toJson(context?: SaveContext, indent?: number): string;
318
+ /**
319
+ * Load a ReferenceConnection instance from a JSON string.
320
+ * @param json - The JSON string to parse.
321
+ * @param context - Optional context with pre/post processing callbacks.
322
+ * @returns The loaded ReferenceConnection instance.
323
+ */
324
+ static fromJson(json: string, context?: LoadContext): ReferenceConnection;
325
+ /**
326
+ * Load a ReferenceConnection instance from a YAML string.
327
+ * @param yaml - The YAML string to parse.
328
+ * @param context - Optional context with pre/post processing callbacks.
329
+ * @returns The loaded ReferenceConnection instance.
330
+ */
331
+ static fromYaml(yaml: string, context?: LoadContext): ReferenceConnection;
332
+ }
333
+ /**
334
+ * Connection configuration for AI services using named connections.
335
+ *
336
+ */
337
+ declare class RemoteConnection extends Connection {
338
+ /**
339
+ * The shorthand property name for this type, if any.
340
+ */
341
+ static readonly shorthandProperty: string | undefined;
342
+ /**
343
+ * The Authentication kind for the AI service (e.g., 'key' for API key, 'oauth' for OAuth tokens)
344
+ */
345
+ kind: string;
346
+ /**
347
+ * The name of the connection
348
+ */
349
+ name: string;
350
+ /**
351
+ * The endpoint URL for the AI service
352
+ */
353
+ endpoint: string;
354
+ /**
355
+ * Initializes a new instance of RemoteConnection.
356
+ */
357
+ constructor(init?: Partial<RemoteConnection>);
358
+ /**
359
+ * Load a RemoteConnection instance from a dictionary.
360
+ * @param data - The dictionary containing the data.
361
+ * @param context - Optional context with pre/post processing callbacks.
362
+ * @returns The loaded RemoteConnection instance.
363
+ */
364
+ static load(data: Record<string, unknown>, context?: LoadContext): RemoteConnection;
365
+ /**
366
+ * Save the RemoteConnection instance to a dictionary.
367
+ * @param context - Optional context with pre/post processing callbacks.
368
+ * @returns The dictionary representation of this instance.
369
+ */
370
+ save(context?: SaveContext): Record<string, unknown>;
371
+ /**
372
+ * Convert the RemoteConnection instance to a YAML string.
373
+ * @param context - Optional context with pre/post processing callbacks.
374
+ * @returns The YAML string representation of this instance.
375
+ */
376
+ toYaml(context?: SaveContext): string;
377
+ /**
378
+ * Convert the RemoteConnection instance to a JSON string.
379
+ * @param context - Optional context with pre/post processing callbacks.
380
+ * @param indent - Number of spaces for indentation. Defaults to 2.
381
+ * @returns The JSON string representation of this instance.
382
+ */
383
+ toJson(context?: SaveContext, indent?: number): string;
384
+ /**
385
+ * Load a RemoteConnection instance from a JSON string.
386
+ * @param json - The JSON string to parse.
387
+ * @param context - Optional context with pre/post processing callbacks.
388
+ * @returns The loaded RemoteConnection instance.
389
+ */
390
+ static fromJson(json: string, context?: LoadContext): RemoteConnection;
391
+ /**
392
+ * Load a RemoteConnection instance from a YAML string.
393
+ * @param yaml - The YAML string to parse.
394
+ * @param context - Optional context with pre/post processing callbacks.
395
+ * @returns The loaded RemoteConnection instance.
396
+ */
397
+ static fromYaml(yaml: string, context?: LoadContext): RemoteConnection;
398
+ }
399
+ /**
400
+ * Connection configuration for AI services using API keys.
401
+ *
402
+ */
403
+ declare class ApiKeyConnection extends Connection {
404
+ /**
405
+ * The shorthand property name for this type, if any.
406
+ */
407
+ static readonly shorthandProperty: string | undefined;
408
+ /**
409
+ * The Authentication kind for the AI service (e.g., 'key' for API key, 'oauth' for OAuth tokens)
410
+ */
411
+ kind: string;
412
+ /**
413
+ * The endpoint URL for the AI service
414
+ */
415
+ endpoint: string;
416
+ /**
417
+ * The API key for authenticating with the AI service
418
+ */
419
+ apiKey: string;
420
+ /**
421
+ * Initializes a new instance of ApiKeyConnection.
422
+ */
423
+ constructor(init?: Partial<ApiKeyConnection>);
424
+ /**
425
+ * Load a ApiKeyConnection instance from a dictionary.
426
+ * @param data - The dictionary containing the data.
427
+ * @param context - Optional context with pre/post processing callbacks.
428
+ * @returns The loaded ApiKeyConnection instance.
429
+ */
430
+ static load(data: Record<string, unknown>, context?: LoadContext): ApiKeyConnection;
431
+ /**
432
+ * Save the ApiKeyConnection instance to a dictionary.
433
+ * @param context - Optional context with pre/post processing callbacks.
434
+ * @returns The dictionary representation of this instance.
435
+ */
436
+ save(context?: SaveContext): Record<string, unknown>;
437
+ /**
438
+ * Convert the ApiKeyConnection instance to a YAML string.
439
+ * @param context - Optional context with pre/post processing callbacks.
440
+ * @returns The YAML string representation of this instance.
441
+ */
442
+ toYaml(context?: SaveContext): string;
443
+ /**
444
+ * Convert the ApiKeyConnection instance to a JSON string.
445
+ * @param context - Optional context with pre/post processing callbacks.
446
+ * @param indent - Number of spaces for indentation. Defaults to 2.
447
+ * @returns The JSON string representation of this instance.
448
+ */
449
+ toJson(context?: SaveContext, indent?: number): string;
450
+ /**
451
+ * Load a ApiKeyConnection instance from a JSON string.
452
+ * @param json - The JSON string to parse.
453
+ * @param context - Optional context with pre/post processing callbacks.
454
+ * @returns The loaded ApiKeyConnection instance.
455
+ */
456
+ static fromJson(json: string, context?: LoadContext): ApiKeyConnection;
457
+ /**
458
+ * Load a ApiKeyConnection instance from a YAML string.
459
+ * @param yaml - The YAML string to parse.
460
+ * @param context - Optional context with pre/post processing callbacks.
461
+ * @returns The loaded ApiKeyConnection instance.
462
+ */
463
+ static fromYaml(yaml: string, context?: LoadContext): ApiKeyConnection;
464
+ }
465
+ /**
466
+ *
467
+ *
468
+ */
469
+ declare class AnonymousConnection extends Connection {
470
+ /**
471
+ * The shorthand property name for this type, if any.
472
+ */
473
+ static readonly shorthandProperty: string | undefined;
474
+ /**
475
+ * The Authentication kind for the AI service (e.g., 'key' for API key, 'oauth' for OAuth tokens)
476
+ */
477
+ kind: string;
478
+ /**
479
+ * The endpoint for authenticating with the AI service
480
+ */
481
+ endpoint: string;
482
+ /**
483
+ * Initializes a new instance of AnonymousConnection.
484
+ */
485
+ constructor(init?: Partial<AnonymousConnection>);
486
+ /**
487
+ * Load a AnonymousConnection instance from a dictionary.
488
+ * @param data - The dictionary containing the data.
489
+ * @param context - Optional context with pre/post processing callbacks.
490
+ * @returns The loaded AnonymousConnection instance.
491
+ */
492
+ static load(data: Record<string, unknown>, context?: LoadContext): AnonymousConnection;
493
+ /**
494
+ * Save the AnonymousConnection instance to a dictionary.
495
+ * @param context - Optional context with pre/post processing callbacks.
496
+ * @returns The dictionary representation of this instance.
497
+ */
498
+ save(context?: SaveContext): Record<string, unknown>;
499
+ /**
500
+ * Convert the AnonymousConnection instance to a YAML string.
501
+ * @param context - Optional context with pre/post processing callbacks.
502
+ * @returns The YAML string representation of this instance.
503
+ */
504
+ toYaml(context?: SaveContext): string;
505
+ /**
506
+ * Convert the AnonymousConnection instance to a JSON string.
507
+ * @param context - Optional context with pre/post processing callbacks.
508
+ * @param indent - Number of spaces for indentation. Defaults to 2.
509
+ * @returns The JSON string representation of this instance.
510
+ */
511
+ toJson(context?: SaveContext, indent?: number): string;
512
+ /**
513
+ * Load a AnonymousConnection instance from a JSON string.
514
+ * @param json - The JSON string to parse.
515
+ * @param context - Optional context with pre/post processing callbacks.
516
+ * @returns The loaded AnonymousConnection instance.
517
+ */
518
+ static fromJson(json: string, context?: LoadContext): AnonymousConnection;
519
+ /**
520
+ * Load a AnonymousConnection instance from a YAML string.
521
+ * @param yaml - The YAML string to parse.
522
+ * @param context - Optional context with pre/post processing callbacks.
523
+ * @returns The loaded AnonymousConnection instance.
524
+ */
525
+ static fromYaml(yaml: string, context?: LoadContext): AnonymousConnection;
526
+ }
527
+ /**
528
+ * Connection configuration for Microsoft Foundry projects.
529
+ * Provides project-scoped access to models, tools, and services
530
+ * via Entra ID (DefaultAzureCredential) authentication.
531
+ *
532
+ */
533
+ declare class FoundryConnection extends Connection {
534
+ /**
535
+ * The shorthand property name for this type, if any.
536
+ */
537
+ static readonly shorthandProperty: string | undefined;
538
+ /**
539
+ * The connection kind for Foundry project access
540
+ */
541
+ kind: string;
542
+ /**
543
+ * The Foundry project endpoint URL
544
+ */
545
+ endpoint: string;
546
+ /**
547
+ * The named connection within the Foundry project
548
+ */
549
+ name?: string | undefined;
550
+ /**
551
+ * The connection type within the Foundry project (e.g., 'model', 'index', 'storage')
552
+ */
553
+ connectionType?: string | undefined;
554
+ /**
555
+ * Initializes a new instance of FoundryConnection.
556
+ */
557
+ constructor(init?: Partial<FoundryConnection>);
558
+ /**
559
+ * Load a FoundryConnection instance from a dictionary.
560
+ * @param data - The dictionary containing the data.
561
+ * @param context - Optional context with pre/post processing callbacks.
562
+ * @returns The loaded FoundryConnection instance.
563
+ */
564
+ static load(data: Record<string, unknown>, context?: LoadContext): FoundryConnection;
565
+ /**
566
+ * Save the FoundryConnection instance to a dictionary.
567
+ * @param context - Optional context with pre/post processing callbacks.
568
+ * @returns The dictionary representation of this instance.
569
+ */
570
+ save(context?: SaveContext): Record<string, unknown>;
571
+ /**
572
+ * Convert the FoundryConnection instance to a YAML string.
573
+ * @param context - Optional context with pre/post processing callbacks.
574
+ * @returns The YAML string representation of this instance.
575
+ */
576
+ toYaml(context?: SaveContext): string;
577
+ /**
578
+ * Convert the FoundryConnection instance to a JSON string.
579
+ * @param context - Optional context with pre/post processing callbacks.
580
+ * @param indent - Number of spaces for indentation. Defaults to 2.
581
+ * @returns The JSON string representation of this instance.
582
+ */
583
+ toJson(context?: SaveContext, indent?: number): string;
584
+ /**
585
+ * Load a FoundryConnection instance from a JSON string.
586
+ * @param json - The JSON string to parse.
587
+ * @param context - Optional context with pre/post processing callbacks.
588
+ * @returns The loaded FoundryConnection instance.
589
+ */
590
+ static fromJson(json: string, context?: LoadContext): FoundryConnection;
591
+ /**
592
+ * Load a FoundryConnection instance from a YAML string.
593
+ * @param yaml - The YAML string to parse.
594
+ * @param context - Optional context with pre/post processing callbacks.
595
+ * @returns The loaded FoundryConnection instance.
596
+ */
597
+ static fromYaml(yaml: string, context?: LoadContext): FoundryConnection;
598
+ }
599
+ /**
600
+ * Connection configuration using OAuth 2.0 client credentials.
601
+ * Useful for tools and services that require OAuth authentication,
602
+ * such as MCP servers, OpenAPI endpoints, or other REST APIs.
603
+ *
604
+ */
605
+ declare class OAuthConnection extends Connection {
606
+ /**
607
+ * The shorthand property name for this type, if any.
608
+ */
609
+ static readonly shorthandProperty: string | undefined;
610
+ /**
611
+ * The connection kind for OAuth authentication
612
+ */
613
+ kind: string;
614
+ /**
615
+ * The endpoint URL for the service
616
+ */
617
+ endpoint: string;
618
+ /**
619
+ * The OAuth client ID
620
+ */
621
+ clientId: string;
622
+ /**
623
+ * The OAuth client secret
624
+ */
625
+ clientSecret: string;
626
+ /**
627
+ * The OAuth token endpoint URL
628
+ */
629
+ tokenUrl: string;
630
+ /**
631
+ * OAuth scopes to request
632
+ */
633
+ scopes?: string[];
634
+ /**
635
+ * Initializes a new instance of OAuthConnection.
636
+ */
637
+ constructor(init?: Partial<OAuthConnection>);
638
+ /**
639
+ * Load a OAuthConnection instance from a dictionary.
640
+ * @param data - The dictionary containing the data.
641
+ * @param context - Optional context with pre/post processing callbacks.
642
+ * @returns The loaded OAuthConnection instance.
643
+ */
644
+ static load(data: Record<string, unknown>, context?: LoadContext): OAuthConnection;
645
+ /**
646
+ * Save the OAuthConnection instance to a dictionary.
647
+ * @param context - Optional context with pre/post processing callbacks.
648
+ * @returns The dictionary representation of this instance.
649
+ */
650
+ save(context?: SaveContext): Record<string, unknown>;
651
+ /**
652
+ * Convert the OAuthConnection instance to a YAML string.
653
+ * @param context - Optional context with pre/post processing callbacks.
654
+ * @returns The YAML string representation of this instance.
655
+ */
656
+ toYaml(context?: SaveContext): string;
657
+ /**
658
+ * Convert the OAuthConnection instance to a JSON string.
659
+ * @param context - Optional context with pre/post processing callbacks.
660
+ * @param indent - Number of spaces for indentation. Defaults to 2.
661
+ * @returns The JSON string representation of this instance.
662
+ */
663
+ toJson(context?: SaveContext, indent?: number): string;
664
+ /**
665
+ * Load a OAuthConnection instance from a JSON string.
666
+ * @param json - The JSON string to parse.
667
+ * @param context - Optional context with pre/post processing callbacks.
668
+ * @returns The loaded OAuthConnection instance.
669
+ */
670
+ static fromJson(json: string, context?: LoadContext): OAuthConnection;
671
+ /**
672
+ * Load a OAuthConnection instance from a YAML string.
673
+ * @param yaml - The YAML string to parse.
674
+ * @param context - Optional context with pre/post processing callbacks.
675
+ * @returns The loaded OAuthConnection instance.
676
+ */
677
+ static fromYaml(yaml: string, context?: LoadContext): OAuthConnection;
678
+ }
679
+
680
+ /**
681
+ * Options for configuring the behavior of the AI model.
682
+ *
683
+ */
684
+ declare class ModelOptions {
685
+ /**
686
+ * The shorthand property name for this type, if any.
687
+ */
688
+ static readonly shorthandProperty: string | undefined;
689
+ /**
690
+ * The frequency penalty to apply to the model's output
691
+ */
692
+ frequencyPenalty?: number | undefined;
693
+ /**
694
+ * The maximum number of tokens to generate in the output
695
+ */
696
+ maxOutputTokens?: number | undefined;
697
+ /**
698
+ * The presence penalty to apply to the model's output
699
+ */
700
+ presencePenalty?: number | undefined;
701
+ /**
702
+ * A random seed for deterministic output
703
+ */
704
+ seed?: number | undefined;
705
+ /**
706
+ * The temperature to use for sampling
707
+ */
708
+ temperature?: number | undefined;
709
+ /**
710
+ * The top-K sampling value
711
+ */
712
+ topK?: number | undefined;
713
+ /**
714
+ * The top-P sampling value
715
+ */
716
+ topP?: number | undefined;
717
+ /**
718
+ * Stop sequences to end generation
719
+ */
720
+ stopSequences?: string[];
721
+ /**
722
+ * Whether to allow multiple tool calls in a single response
723
+ */
724
+ allowMultipleToolCalls?: boolean | undefined;
725
+ /**
726
+ * Additional custom properties for model options
727
+ */
728
+ additionalProperties?: Record<string, unknown> | undefined;
729
+ /**
730
+ * Initializes a new instance of ModelOptions.
731
+ */
732
+ constructor(init?: Partial<ModelOptions>);
733
+ /**
734
+ * Load a ModelOptions instance from a dictionary.
735
+ * @param data - The dictionary containing the data.
736
+ * @param context - Optional context with pre/post processing callbacks.
737
+ * @returns The loaded ModelOptions instance.
738
+ */
739
+ static load(data: Record<string, unknown>, context?: LoadContext): ModelOptions;
740
+ /**
741
+ * Save the ModelOptions instance to a dictionary.
742
+ * @param context - Optional context with pre/post processing callbacks.
743
+ * @returns The dictionary representation of this instance.
744
+ */
745
+ save(context?: SaveContext): Record<string, unknown>;
746
+ /**
747
+ * Convert the ModelOptions instance to a YAML string.
748
+ * @param context - Optional context with pre/post processing callbacks.
749
+ * @returns The YAML string representation of this instance.
750
+ */
751
+ toYaml(context?: SaveContext): string;
752
+ /**
753
+ * Convert the ModelOptions instance to a JSON string.
754
+ * @param context - Optional context with pre/post processing callbacks.
755
+ * @param indent - Number of spaces for indentation. Defaults to 2.
756
+ * @returns The JSON string representation of this instance.
757
+ */
758
+ toJson(context?: SaveContext, indent?: number): string;
759
+ /**
760
+ * Load a ModelOptions instance from a JSON string.
761
+ * @param json - The JSON string to parse.
762
+ * @param context - Optional context with pre/post processing callbacks.
763
+ * @returns The loaded ModelOptions instance.
764
+ */
765
+ static fromJson(json: string, context?: LoadContext): ModelOptions;
766
+ /**
767
+ * Load a ModelOptions instance from a YAML string.
768
+ * @param yaml - The YAML string to parse.
769
+ * @param context - Optional context with pre/post processing callbacks.
770
+ * @returns The loaded ModelOptions instance.
771
+ */
772
+ static fromYaml(yaml: string, context?: LoadContext): ModelOptions;
773
+ }
774
+
775
+ /**
776
+ * Model for defining the structure and behavior of AI agents.
777
+ * This model includes properties for specifying the model's provider, connection details, and various options.
778
+ * It allows for flexible configuration of AI models to suit different use cases and requirements.
779
+ *
780
+ */
781
+ declare class Model {
782
+ /**
783
+ * The shorthand property name for this type, if any.
784
+ */
785
+ static readonly shorthandProperty: string | undefined;
786
+ /**
787
+ * The unique identifier of the model - can be used as the single property shorthand
788
+ */
789
+ id: string;
790
+ /**
791
+ * The provider of the model (e.g., 'openai', 'azure', 'anthropic')
792
+ */
793
+ provider?: string | undefined;
794
+ /**
795
+ * The type of API to use for the model (e.g., 'chat', 'response', etc.)
796
+ */
797
+ apiType?: string | undefined;
798
+ /**
799
+ * The connection configuration for the model
800
+ */
801
+ connection?: Connection | undefined;
802
+ /**
803
+ * Additional options for the model
804
+ */
805
+ options?: ModelOptions | undefined;
806
+ /**
807
+ * Initializes a new instance of Model.
808
+ */
809
+ constructor(init?: Partial<Model>);
810
+ /**
811
+ * Load a Model instance from a dictionary.
812
+ * @param data - The dictionary containing the data.
813
+ * @param context - Optional context with pre/post processing callbacks.
814
+ * @returns The loaded Model instance.
815
+ */
816
+ static load(data: Record<string, unknown>, context?: LoadContext): Model;
817
+ /**
818
+ * Save the Model instance to a dictionary.
819
+ * @param context - Optional context with pre/post processing callbacks.
820
+ * @returns The dictionary representation of this instance.
821
+ */
822
+ save(context?: SaveContext): Record<string, unknown>;
823
+ /**
824
+ * Convert the Model instance to a YAML string.
825
+ * @param context - Optional context with pre/post processing callbacks.
826
+ * @returns The YAML string representation of this instance.
827
+ */
828
+ toYaml(context?: SaveContext): string;
829
+ /**
830
+ * Convert the Model instance to a JSON string.
831
+ * @param context - Optional context with pre/post processing callbacks.
832
+ * @param indent - Number of spaces for indentation. Defaults to 2.
833
+ * @returns The JSON string representation of this instance.
834
+ */
835
+ toJson(context?: SaveContext, indent?: number): string;
836
+ /**
837
+ * Load a Model instance from a JSON string.
838
+ * @param json - The JSON string to parse.
839
+ * @param context - Optional context with pre/post processing callbacks.
840
+ * @returns The loaded Model instance.
841
+ */
842
+ static fromJson(json: string, context?: LoadContext): Model;
843
+ /**
844
+ * Load a Model instance from a YAML string.
845
+ * @param yaml - The YAML string to parse.
846
+ * @param context - Optional context with pre/post processing callbacks.
847
+ * @returns The loaded Model instance.
848
+ */
849
+ static fromYaml(yaml: string, context?: LoadContext): Model;
850
+ }
851
+
852
+ /**
853
+ * Represents a single property.
854
+ *
855
+ * - This model defines the structure of properties that can be used in prompts,
856
+ * including their type, description, whether they are required, and other attributes.
857
+ * - It allows for the definition of dynamic inputs that can be filled with data
858
+ * and processed to generate prompts for AI models.
859
+ *
860
+ */
861
+ declare class Property {
862
+ /**
863
+ * The shorthand property name for this type, if any.
864
+ */
865
+ static readonly shorthandProperty: string | undefined;
866
+ /**
867
+ * Name of the property
868
+ */
869
+ name: string;
870
+ /**
871
+ * The data type of the input property
872
+ */
873
+ kind: string;
874
+ /**
875
+ * A short description of the input property
876
+ */
877
+ description?: string | undefined;
878
+ /**
879
+ * Whether the property is required
880
+ */
881
+ required?: boolean | undefined;
882
+ /**
883
+ * The default value of the property - this represents the default value if none is provided
884
+ */
885
+ default?: unknown | undefined;
886
+ /**
887
+ * Example value used for either initialization or tooling
888
+ */
889
+ example?: unknown | undefined;
890
+ /**
891
+ * Allowed enumeration values for the property
892
+ */
893
+ enumValues?: unknown[];
894
+ /**
895
+ * Initializes a new instance of Property.
896
+ */
897
+ constructor(init?: Partial<Property>);
898
+ /**
899
+ * Load a Property instance from a dictionary.
900
+ * @param data - The dictionary containing the data.
901
+ * @param context - Optional context with pre/post processing callbacks.
902
+ * @returns The loaded Property instance.
903
+ */
904
+ static load(data: Record<string, unknown>, context?: LoadContext): Property;
905
+ /**
906
+ * Load polymorphic Property based on discriminator.
907
+ * @param data - The dictionary containing the data.
908
+ * @param context - Optional context with pre/post processing callbacks.
909
+ * @returns The loaded Property instance.
910
+ */
911
+ private static loadKind;
912
+ /**
913
+ * Save the Property instance to a dictionary.
914
+ * @param context - Optional context with pre/post processing callbacks.
915
+ * @returns The dictionary representation of this instance.
916
+ */
917
+ save(context?: SaveContext): Record<string, unknown>;
918
+ /**
919
+ * Convert the Property instance to a YAML string.
920
+ * @param context - Optional context with pre/post processing callbacks.
921
+ * @returns The YAML string representation of this instance.
922
+ */
923
+ toYaml(context?: SaveContext): string;
924
+ /**
925
+ * Convert the Property instance to a JSON string.
926
+ * @param context - Optional context with pre/post processing callbacks.
927
+ * @param indent - Number of spaces for indentation. Defaults to 2.
928
+ * @returns The JSON string representation of this instance.
929
+ */
930
+ toJson(context?: SaveContext, indent?: number): string;
931
+ /**
932
+ * Load a Property instance from a JSON string.
933
+ * @param json - The JSON string to parse.
934
+ * @param context - Optional context with pre/post processing callbacks.
935
+ * @returns The loaded Property instance.
936
+ */
937
+ static fromJson(json: string, context?: LoadContext): Property;
938
+ /**
939
+ * Load a Property instance from a YAML string.
940
+ * @param yaml - The YAML string to parse.
941
+ * @param context - Optional context with pre/post processing callbacks.
942
+ * @returns The loaded Property instance.
943
+ */
944
+ static fromYaml(yaml: string, context?: LoadContext): Property;
945
+ }
946
+ /**
947
+ * Represents an array property.
948
+ * This extends the base Property model to represent an array of items.
949
+ *
950
+ */
951
+ declare class ArrayProperty extends Property {
952
+ /**
953
+ * The shorthand property name for this type, if any.
954
+ */
955
+ static readonly shorthandProperty: string | undefined;
956
+ /**
957
+ *
958
+ */
959
+ kind: string;
960
+ /**
961
+ * The type of items contained in the array
962
+ */
963
+ items: Property;
964
+ /**
965
+ * Initializes a new instance of ArrayProperty.
966
+ */
967
+ constructor(init?: Partial<ArrayProperty>);
968
+ /**
969
+ * Load a ArrayProperty instance from a dictionary.
970
+ * @param data - The dictionary containing the data.
971
+ * @param context - Optional context with pre/post processing callbacks.
972
+ * @returns The loaded ArrayProperty instance.
973
+ */
974
+ static load(data: Record<string, unknown>, context?: LoadContext): ArrayProperty;
975
+ /**
976
+ * Save the ArrayProperty instance to a dictionary.
977
+ * @param context - Optional context with pre/post processing callbacks.
978
+ * @returns The dictionary representation of this instance.
979
+ */
980
+ save(context?: SaveContext): Record<string, unknown>;
981
+ /**
982
+ * Convert the ArrayProperty instance to a YAML string.
983
+ * @param context - Optional context with pre/post processing callbacks.
984
+ * @returns The YAML string representation of this instance.
985
+ */
986
+ toYaml(context?: SaveContext): string;
987
+ /**
988
+ * Convert the ArrayProperty instance to a JSON string.
989
+ * @param context - Optional context with pre/post processing callbacks.
990
+ * @param indent - Number of spaces for indentation. Defaults to 2.
991
+ * @returns The JSON string representation of this instance.
992
+ */
993
+ toJson(context?: SaveContext, indent?: number): string;
994
+ /**
995
+ * Load a ArrayProperty instance from a JSON string.
996
+ * @param json - The JSON string to parse.
997
+ * @param context - Optional context with pre/post processing callbacks.
998
+ * @returns The loaded ArrayProperty instance.
999
+ */
1000
+ static fromJson(json: string, context?: LoadContext): ArrayProperty;
1001
+ /**
1002
+ * Load a ArrayProperty instance from a YAML string.
1003
+ * @param yaml - The YAML string to parse.
1004
+ * @param context - Optional context with pre/post processing callbacks.
1005
+ * @returns The loaded ArrayProperty instance.
1006
+ */
1007
+ static fromYaml(yaml: string, context?: LoadContext): ArrayProperty;
1008
+ }
1009
+ /**
1010
+ * Represents an object property.
1011
+ * This extends the base Property model to represent a structured object.
1012
+ *
1013
+ */
1014
+ declare class ObjectProperty extends Property {
1015
+ /**
1016
+ * The shorthand property name for this type, if any.
1017
+ */
1018
+ static readonly shorthandProperty: string | undefined;
1019
+ /**
1020
+ *
1021
+ */
1022
+ kind: string;
1023
+ /**
1024
+ * The properties contained in the object
1025
+ */
1026
+ properties: Property[];
1027
+ /**
1028
+ * Initializes a new instance of ObjectProperty.
1029
+ */
1030
+ constructor(init?: Partial<ObjectProperty>);
1031
+ /**
1032
+ * Load a ObjectProperty instance from a dictionary.
1033
+ * @param data - The dictionary containing the data.
1034
+ * @param context - Optional context with pre/post processing callbacks.
1035
+ * @returns The loaded ObjectProperty instance.
1036
+ */
1037
+ static load(data: Record<string, unknown>, context?: LoadContext): ObjectProperty;
1038
+ /**
1039
+ * Load a collection of Property from a dictionary or array.
1040
+ * @param data - The data to load from.
1041
+ * @param context - Optional context with pre/post processing callbacks.
1042
+ * @returns The loaded array of Property.
1043
+ */
1044
+ static loadProperties(data: unknown, context?: LoadContext): Property[];
1045
+ /**
1046
+ * Save the ObjectProperty instance to a dictionary.
1047
+ * @param context - Optional context with pre/post processing callbacks.
1048
+ * @returns The dictionary representation of this instance.
1049
+ */
1050
+ save(context?: SaveContext): Record<string, unknown>;
1051
+ /**
1052
+ * Save a collection of Property to object or array format.
1053
+ * @param items - The items to save.
1054
+ * @param context - Optional context with pre/post processing callbacks.
1055
+ * @returns The saved collection in object or array format.
1056
+ */
1057
+ static saveProperties(items: Property[], context?: SaveContext): Record<string, unknown> | Record<string, unknown>[];
1058
+ /**
1059
+ * Convert the ObjectProperty instance to a YAML string.
1060
+ * @param context - Optional context with pre/post processing callbacks.
1061
+ * @returns The YAML string representation of this instance.
1062
+ */
1063
+ toYaml(context?: SaveContext): string;
1064
+ /**
1065
+ * Convert the ObjectProperty instance to a JSON string.
1066
+ * @param context - Optional context with pre/post processing callbacks.
1067
+ * @param indent - Number of spaces for indentation. Defaults to 2.
1068
+ * @returns The JSON string representation of this instance.
1069
+ */
1070
+ toJson(context?: SaveContext, indent?: number): string;
1071
+ /**
1072
+ * Load a ObjectProperty instance from a JSON string.
1073
+ * @param json - The JSON string to parse.
1074
+ * @param context - Optional context with pre/post processing callbacks.
1075
+ * @returns The loaded ObjectProperty instance.
1076
+ */
1077
+ static fromJson(json: string, context?: LoadContext): ObjectProperty;
1078
+ /**
1079
+ * Load a ObjectProperty instance from a YAML string.
1080
+ * @param yaml - The YAML string to parse.
1081
+ * @param context - Optional context with pre/post processing callbacks.
1082
+ * @returns The loaded ObjectProperty instance.
1083
+ */
1084
+ static fromYaml(yaml: string, context?: LoadContext): ObjectProperty;
1085
+ }
1086
+
1087
+ /**
1088
+ * Template format definition
1089
+ *
1090
+ */
1091
+ declare class Format {
1092
+ /**
1093
+ * The shorthand property name for this type, if any.
1094
+ */
1095
+ static readonly shorthandProperty: string | undefined;
1096
+ /**
1097
+ * Template rendering engine used for slot filling prompts (e.g., mustache, jinja2)
1098
+ */
1099
+ kind: string;
1100
+ /**
1101
+ * Whether the template can emit structural text for parsing output
1102
+ */
1103
+ strict?: boolean | undefined;
1104
+ /**
1105
+ * Options for the template engine
1106
+ */
1107
+ options?: Record<string, unknown> | undefined;
1108
+ /**
1109
+ * Initializes a new instance of Format.
1110
+ */
1111
+ constructor(init?: Partial<Format>);
1112
+ /**
1113
+ * Load a Format instance from a dictionary.
1114
+ * @param data - The dictionary containing the data.
1115
+ * @param context - Optional context with pre/post processing callbacks.
1116
+ * @returns The loaded Format instance.
1117
+ */
1118
+ static load(data: Record<string, unknown>, context?: LoadContext): Format;
1119
+ /**
1120
+ * Save the Format instance to a dictionary.
1121
+ * @param context - Optional context with pre/post processing callbacks.
1122
+ * @returns The dictionary representation of this instance.
1123
+ */
1124
+ save(context?: SaveContext): Record<string, unknown>;
1125
+ /**
1126
+ * Convert the Format instance to a YAML string.
1127
+ * @param context - Optional context with pre/post processing callbacks.
1128
+ * @returns The YAML string representation of this instance.
1129
+ */
1130
+ toYaml(context?: SaveContext): string;
1131
+ /**
1132
+ * Convert the Format instance to a JSON string.
1133
+ * @param context - Optional context with pre/post processing callbacks.
1134
+ * @param indent - Number of spaces for indentation. Defaults to 2.
1135
+ * @returns The JSON string representation of this instance.
1136
+ */
1137
+ toJson(context?: SaveContext, indent?: number): string;
1138
+ /**
1139
+ * Load a Format instance from a JSON string.
1140
+ * @param json - The JSON string to parse.
1141
+ * @param context - Optional context with pre/post processing callbacks.
1142
+ * @returns The loaded Format instance.
1143
+ */
1144
+ static fromJson(json: string, context?: LoadContext): Format;
1145
+ /**
1146
+ * Load a Format instance from a YAML string.
1147
+ * @param yaml - The YAML string to parse.
1148
+ * @param context - Optional context with pre/post processing callbacks.
1149
+ * @returns The loaded Format instance.
1150
+ */
1151
+ static fromYaml(yaml: string, context?: LoadContext): Format;
1152
+ }
1153
+
1154
+ /**
1155
+ * Template parser definition
1156
+ *
1157
+ */
1158
+ declare class Parser$1 {
1159
+ /**
1160
+ * The shorthand property name for this type, if any.
1161
+ */
1162
+ static readonly shorthandProperty: string | undefined;
1163
+ /**
1164
+ * Parser used to process the rendered template into API-compatible format
1165
+ */
1166
+ kind: string;
1167
+ /**
1168
+ * Options for the parser
1169
+ */
1170
+ options?: Record<string, unknown> | undefined;
1171
+ /**
1172
+ * Initializes a new instance of Parser.
1173
+ */
1174
+ constructor(init?: Partial<Parser$1>);
1175
+ /**
1176
+ * Load a Parser instance from a dictionary.
1177
+ * @param data - The dictionary containing the data.
1178
+ * @param context - Optional context with pre/post processing callbacks.
1179
+ * @returns The loaded Parser instance.
1180
+ */
1181
+ static load(data: Record<string, unknown>, context?: LoadContext): Parser$1;
1182
+ /**
1183
+ * Save the Parser instance to a dictionary.
1184
+ * @param context - Optional context with pre/post processing callbacks.
1185
+ * @returns The dictionary representation of this instance.
1186
+ */
1187
+ save(context?: SaveContext): Record<string, unknown>;
1188
+ /**
1189
+ * Convert the Parser instance to a YAML string.
1190
+ * @param context - Optional context with pre/post processing callbacks.
1191
+ * @returns The YAML string representation of this instance.
1192
+ */
1193
+ toYaml(context?: SaveContext): string;
1194
+ /**
1195
+ * Convert the Parser instance to a JSON string.
1196
+ * @param context - Optional context with pre/post processing callbacks.
1197
+ * @param indent - Number of spaces for indentation. Defaults to 2.
1198
+ * @returns The JSON string representation of this instance.
1199
+ */
1200
+ toJson(context?: SaveContext, indent?: number): string;
1201
+ /**
1202
+ * Load a Parser instance from a JSON string.
1203
+ * @param json - The JSON string to parse.
1204
+ * @param context - Optional context with pre/post processing callbacks.
1205
+ * @returns The loaded Parser instance.
1206
+ */
1207
+ static fromJson(json: string, context?: LoadContext): Parser$1;
1208
+ /**
1209
+ * Load a Parser instance from a YAML string.
1210
+ * @param yaml - The YAML string to parse.
1211
+ * @param context - Optional context with pre/post processing callbacks.
1212
+ * @returns The loaded Parser instance.
1213
+ */
1214
+ static fromYaml(yaml: string, context?: LoadContext): Parser$1;
1215
+ }
1216
+
1217
+ /**
1218
+ * Template model for defining prompt templates.
1219
+ *
1220
+ * This model specifies the rendering engine used for slot filling prompts,
1221
+ * the parser used to process the rendered template into API-compatible format,
1222
+ * and additional options for the template engine.
1223
+ *
1224
+ * It allows for the creation of reusable templates that can be filled with dynamic data
1225
+ * and processed to generate prompts for AI models.
1226
+ *
1227
+ */
1228
+ declare class Template {
1229
+ /**
1230
+ * The shorthand property name for this type, if any.
1231
+ */
1232
+ static readonly shorthandProperty: string | undefined;
1233
+ /**
1234
+ * Template rendering engine used for slot filling prompts (e.g., mustache, jinja2)
1235
+ */
1236
+ format: Format;
1237
+ /**
1238
+ * Parser used to process the rendered template into API-compatible format
1239
+ */
1240
+ parser: Parser$1;
1241
+ /**
1242
+ * Initializes a new instance of Template.
1243
+ */
1244
+ constructor(init?: Partial<Template>);
1245
+ /**
1246
+ * Load a Template instance from a dictionary.
1247
+ * @param data - The dictionary containing the data.
1248
+ * @param context - Optional context with pre/post processing callbacks.
1249
+ * @returns The loaded Template instance.
1250
+ */
1251
+ static load(data: Record<string, unknown>, context?: LoadContext): Template;
1252
+ /**
1253
+ * Save the Template instance to a dictionary.
1254
+ * @param context - Optional context with pre/post processing callbacks.
1255
+ * @returns The dictionary representation of this instance.
1256
+ */
1257
+ save(context?: SaveContext): Record<string, unknown>;
1258
+ /**
1259
+ * Convert the Template instance to a YAML string.
1260
+ * @param context - Optional context with pre/post processing callbacks.
1261
+ * @returns The YAML string representation of this instance.
1262
+ */
1263
+ toYaml(context?: SaveContext): string;
1264
+ /**
1265
+ * Convert the Template instance to a JSON string.
1266
+ * @param context - Optional context with pre/post processing callbacks.
1267
+ * @param indent - Number of spaces for indentation. Defaults to 2.
1268
+ * @returns The JSON string representation of this instance.
1269
+ */
1270
+ toJson(context?: SaveContext, indent?: number): string;
1271
+ /**
1272
+ * Load a Template instance from a JSON string.
1273
+ * @param json - The JSON string to parse.
1274
+ * @param context - Optional context with pre/post processing callbacks.
1275
+ * @returns The loaded Template instance.
1276
+ */
1277
+ static fromJson(json: string, context?: LoadContext): Template;
1278
+ /**
1279
+ * Load a Template instance from a YAML string.
1280
+ * @param yaml - The YAML string to parse.
1281
+ * @param context - Optional context with pre/post processing callbacks.
1282
+ * @returns The loaded Template instance.
1283
+ */
1284
+ static fromYaml(yaml: string, context?: LoadContext): Template;
1285
+ }
1286
+
1287
+ /**
1288
+ * Represents a binding between an input property and a tool parameter.
1289
+ *
1290
+ */
1291
+ declare class Binding {
1292
+ /**
1293
+ * The shorthand property name for this type, if any.
1294
+ */
1295
+ static readonly shorthandProperty: string | undefined;
1296
+ /**
1297
+ * Name of the binding
1298
+ */
1299
+ name: string;
1300
+ /**
1301
+ * The input property that will be bound to the tool parameter argument
1302
+ */
1303
+ input: string;
1304
+ /**
1305
+ * Initializes a new instance of Binding.
1306
+ */
1307
+ constructor(init?: Partial<Binding>);
1308
+ /**
1309
+ * Load a Binding instance from a dictionary.
1310
+ * @param data - The dictionary containing the data.
1311
+ * @param context - Optional context with pre/post processing callbacks.
1312
+ * @returns The loaded Binding instance.
1313
+ */
1314
+ static load(data: Record<string, unknown>, context?: LoadContext): Binding;
1315
+ /**
1316
+ * Save the Binding instance to a dictionary.
1317
+ * @param context - Optional context with pre/post processing callbacks.
1318
+ * @returns The dictionary representation of this instance.
1319
+ */
1320
+ save(context?: SaveContext): Record<string, unknown>;
1321
+ /**
1322
+ * Convert the Binding instance to a YAML string.
1323
+ * @param context - Optional context with pre/post processing callbacks.
1324
+ * @returns The YAML string representation of this instance.
1325
+ */
1326
+ toYaml(context?: SaveContext): string;
1327
+ /**
1328
+ * Convert the Binding instance to a JSON string.
1329
+ * @param context - Optional context with pre/post processing callbacks.
1330
+ * @param indent - Number of spaces for indentation. Defaults to 2.
1331
+ * @returns The JSON string representation of this instance.
1332
+ */
1333
+ toJson(context?: SaveContext, indent?: number): string;
1334
+ /**
1335
+ * Load a Binding instance from a JSON string.
1336
+ * @param json - The JSON string to parse.
1337
+ * @param context - Optional context with pre/post processing callbacks.
1338
+ * @returns The loaded Binding instance.
1339
+ */
1340
+ static fromJson(json: string, context?: LoadContext): Binding;
1341
+ /**
1342
+ * Load a Binding instance from a YAML string.
1343
+ * @param yaml - The YAML string to parse.
1344
+ * @param context - Optional context with pre/post processing callbacks.
1345
+ * @returns The loaded Binding instance.
1346
+ */
1347
+ static fromYaml(yaml: string, context?: LoadContext): Binding;
1348
+ }
1349
+
1350
+ /**
1351
+ * The approval mode for MCP server tools.
1352
+ * When kind is "specify", use alwaysRequireApprovalTools and neverRequireApprovalTools
1353
+ * to control per-tool approval. For "always" and "never", those fields are ignored.
1354
+ *
1355
+ */
1356
+ declare class McpApprovalMode {
1357
+ /**
1358
+ * The shorthand property name for this type, if any.
1359
+ */
1360
+ static readonly shorthandProperty: string | undefined;
1361
+ /**
1362
+ * The approval mode: 'always', 'never', or 'specify'
1363
+ */
1364
+ kind: string;
1365
+ /**
1366
+ * List of tools that always require approval (only used when kind is 'specify')
1367
+ */
1368
+ alwaysRequireApprovalTools?: string[];
1369
+ /**
1370
+ * List of tools that never require approval (only used when kind is 'specify')
1371
+ */
1372
+ neverRequireApprovalTools?: string[];
1373
+ /**
1374
+ * Initializes a new instance of McpApprovalMode.
1375
+ */
1376
+ constructor(init?: Partial<McpApprovalMode>);
1377
+ /**
1378
+ * Load a McpApprovalMode instance from a dictionary.
1379
+ * @param data - The dictionary containing the data.
1380
+ * @param context - Optional context with pre/post processing callbacks.
1381
+ * @returns The loaded McpApprovalMode instance.
1382
+ */
1383
+ static load(data: Record<string, unknown>, context?: LoadContext): McpApprovalMode;
1384
+ /**
1385
+ * Save the McpApprovalMode instance to a dictionary.
1386
+ * @param context - Optional context with pre/post processing callbacks.
1387
+ * @returns The dictionary representation of this instance.
1388
+ */
1389
+ save(context?: SaveContext): Record<string, unknown>;
1390
+ /**
1391
+ * Convert the McpApprovalMode instance to a YAML string.
1392
+ * @param context - Optional context with pre/post processing callbacks.
1393
+ * @returns The YAML string representation of this instance.
1394
+ */
1395
+ toYaml(context?: SaveContext): string;
1396
+ /**
1397
+ * Convert the McpApprovalMode instance to a JSON string.
1398
+ * @param context - Optional context with pre/post processing callbacks.
1399
+ * @param indent - Number of spaces for indentation. Defaults to 2.
1400
+ * @returns The JSON string representation of this instance.
1401
+ */
1402
+ toJson(context?: SaveContext, indent?: number): string;
1403
+ /**
1404
+ * Load a McpApprovalMode instance from a JSON string.
1405
+ * @param json - The JSON string to parse.
1406
+ * @param context - Optional context with pre/post processing callbacks.
1407
+ * @returns The loaded McpApprovalMode instance.
1408
+ */
1409
+ static fromJson(json: string, context?: LoadContext): McpApprovalMode;
1410
+ /**
1411
+ * Load a McpApprovalMode instance from a YAML string.
1412
+ * @param yaml - The YAML string to parse.
1413
+ * @param context - Optional context with pre/post processing callbacks.
1414
+ * @returns The loaded McpApprovalMode instance.
1415
+ */
1416
+ static fromYaml(yaml: string, context?: LoadContext): McpApprovalMode;
1417
+ }
1418
+
1419
+ /**
1420
+ * Represents a tool that can be used in prompts.
1421
+ *
1422
+ */
1423
+ declare abstract class Tool {
1424
+ /**
1425
+ * The shorthand property name for this type, if any.
1426
+ */
1427
+ static readonly shorthandProperty: string | undefined;
1428
+ /**
1429
+ * Name of the tool. If a function tool, this is the function name, otherwise it is the type
1430
+ */
1431
+ name: string;
1432
+ /**
1433
+ * The kind identifier for the tool
1434
+ */
1435
+ kind: string;
1436
+ /**
1437
+ * A short description of the tool for metadata purposes
1438
+ */
1439
+ description?: string | undefined;
1440
+ /**
1441
+ * Tool argument bindings to input properties
1442
+ */
1443
+ bindings?: Binding[];
1444
+ /**
1445
+ * Initializes a new instance of Tool.
1446
+ */
1447
+ constructor(init?: Partial<Tool>);
1448
+ /**
1449
+ * Load a Tool instance from a dictionary.
1450
+ * @param data - The dictionary containing the data.
1451
+ * @param context - Optional context with pre/post processing callbacks.
1452
+ * @returns The loaded Tool instance.
1453
+ */
1454
+ static load(data: Record<string, unknown>, context?: LoadContext): Tool;
1455
+ /**
1456
+ * Load a collection of Binding from a dictionary or array.
1457
+ * @param data - The data to load from.
1458
+ * @param context - Optional context with pre/post processing callbacks.
1459
+ * @returns The loaded array of Binding.
1460
+ */
1461
+ static loadBindings(data: unknown, context?: LoadContext): Binding[];
1462
+ /**
1463
+ * Load polymorphic Tool based on discriminator.
1464
+ * @param data - The dictionary containing the data.
1465
+ * @param context - Optional context with pre/post processing callbacks.
1466
+ * @returns The loaded Tool instance.
1467
+ */
1468
+ private static loadKind;
1469
+ /**
1470
+ * Save the Tool instance to a dictionary.
1471
+ * @param context - Optional context with pre/post processing callbacks.
1472
+ * @returns The dictionary representation of this instance.
1473
+ */
1474
+ save(context?: SaveContext): Record<string, unknown>;
1475
+ /**
1476
+ * Save a collection of Binding to object or array format.
1477
+ * @param items - The items to save.
1478
+ * @param context - Optional context with pre/post processing callbacks.
1479
+ * @returns The saved collection in object or array format.
1480
+ */
1481
+ static saveBindings(items: Binding[], context?: SaveContext): Record<string, unknown> | Record<string, unknown>[];
1482
+ /**
1483
+ * Convert the Tool instance to a YAML string.
1484
+ * @param context - Optional context with pre/post processing callbacks.
1485
+ * @returns The YAML string representation of this instance.
1486
+ */
1487
+ toYaml(context?: SaveContext): string;
1488
+ /**
1489
+ * Convert the Tool instance to a JSON string.
1490
+ * @param context - Optional context with pre/post processing callbacks.
1491
+ * @param indent - Number of spaces for indentation. Defaults to 2.
1492
+ * @returns The JSON string representation of this instance.
1493
+ */
1494
+ toJson(context?: SaveContext, indent?: number): string;
1495
+ /**
1496
+ * Load a Tool instance from a JSON string.
1497
+ * @param json - The JSON string to parse.
1498
+ * @param context - Optional context with pre/post processing callbacks.
1499
+ * @returns The loaded Tool instance.
1500
+ */
1501
+ static fromJson(json: string, context?: LoadContext): Tool;
1502
+ /**
1503
+ * Load a Tool instance from a YAML string.
1504
+ * @param yaml - The YAML string to parse.
1505
+ * @param context - Optional context with pre/post processing callbacks.
1506
+ * @returns The loaded Tool instance.
1507
+ */
1508
+ static fromYaml(yaml: string, context?: LoadContext): Tool;
1509
+ }
1510
+ /**
1511
+ * Represents a local function tool.
1512
+ *
1513
+ */
1514
+ declare class FunctionTool extends Tool {
1515
+ /**
1516
+ * The shorthand property name for this type, if any.
1517
+ */
1518
+ static readonly shorthandProperty: string | undefined;
1519
+ /**
1520
+ * The kind identifier for function tools
1521
+ */
1522
+ kind: string;
1523
+ /**
1524
+ * Parameters accepted by the function tool
1525
+ */
1526
+ parameters: Property[];
1527
+ /**
1528
+ * Indicates whether the function tool enforces strict validation on its parameters
1529
+ */
1530
+ strict?: boolean | undefined;
1531
+ /**
1532
+ * Initializes a new instance of FunctionTool.
1533
+ */
1534
+ constructor(init?: Partial<FunctionTool>);
1535
+ /**
1536
+ * Load a FunctionTool instance from a dictionary.
1537
+ * @param data - The dictionary containing the data.
1538
+ * @param context - Optional context with pre/post processing callbacks.
1539
+ * @returns The loaded FunctionTool instance.
1540
+ */
1541
+ static load(data: Record<string, unknown>, context?: LoadContext): FunctionTool;
1542
+ /**
1543
+ * Load a collection of Property from a dictionary or array.
1544
+ * @param data - The data to load from.
1545
+ * @param context - Optional context with pre/post processing callbacks.
1546
+ * @returns The loaded array of Property.
1547
+ */
1548
+ static loadParameters(data: unknown, context?: LoadContext): Property[];
1549
+ /**
1550
+ * Save the FunctionTool instance to a dictionary.
1551
+ * @param context - Optional context with pre/post processing callbacks.
1552
+ * @returns The dictionary representation of this instance.
1553
+ */
1554
+ save(context?: SaveContext): Record<string, unknown>;
1555
+ /**
1556
+ * Save a collection of Property to object or array format.
1557
+ * @param items - The items to save.
1558
+ * @param context - Optional context with pre/post processing callbacks.
1559
+ * @returns The saved collection in object or array format.
1560
+ */
1561
+ static saveParameters(items: Property[], context?: SaveContext): Record<string, unknown> | Record<string, unknown>[];
1562
+ /**
1563
+ * Convert the FunctionTool instance to a YAML string.
1564
+ * @param context - Optional context with pre/post processing callbacks.
1565
+ * @returns The YAML string representation of this instance.
1566
+ */
1567
+ toYaml(context?: SaveContext): string;
1568
+ /**
1569
+ * Convert the FunctionTool instance to a JSON string.
1570
+ * @param context - Optional context with pre/post processing callbacks.
1571
+ * @param indent - Number of spaces for indentation. Defaults to 2.
1572
+ * @returns The JSON string representation of this instance.
1573
+ */
1574
+ toJson(context?: SaveContext, indent?: number): string;
1575
+ /**
1576
+ * Load a FunctionTool instance from a JSON string.
1577
+ * @param json - The JSON string to parse.
1578
+ * @param context - Optional context with pre/post processing callbacks.
1579
+ * @returns The loaded FunctionTool instance.
1580
+ */
1581
+ static fromJson(json: string, context?: LoadContext): FunctionTool;
1582
+ /**
1583
+ * Load a FunctionTool instance from a YAML string.
1584
+ * @param yaml - The YAML string to parse.
1585
+ * @param context - Optional context with pre/post processing callbacks.
1586
+ * @returns The loaded FunctionTool instance.
1587
+ */
1588
+ static fromYaml(yaml: string, context?: LoadContext): FunctionTool;
1589
+ }
1590
+ /**
1591
+ * Represents a generic server tool that runs on a server
1592
+ * This tool kind is designed for operations that require server-side execution
1593
+ * It may include features such as authentication, data storage, and long-running processes
1594
+ * This tool kind is ideal for tasks that involve complex computations or access to secure resources
1595
+ * Server tools can be used to offload heavy processing from client applications
1596
+ *
1597
+ */
1598
+ declare class CustomTool extends Tool {
1599
+ /**
1600
+ * The shorthand property name for this type, if any.
1601
+ */
1602
+ static readonly shorthandProperty: string | undefined;
1603
+ /**
1604
+ * The kind identifier for server tools. This is a wildcard and can represent any server tool type not explicitly defined.
1605
+ */
1606
+ kind: string;
1607
+ /**
1608
+ * Connection configuration for the server tool
1609
+ */
1610
+ connection: Connection;
1611
+ /**
1612
+ * Configuration options for the server tool
1613
+ */
1614
+ options: Record<string, unknown>;
1615
+ /**
1616
+ * Initializes a new instance of CustomTool.
1617
+ */
1618
+ constructor(init?: Partial<CustomTool>);
1619
+ /**
1620
+ * Load a CustomTool instance from a dictionary.
1621
+ * @param data - The dictionary containing the data.
1622
+ * @param context - Optional context with pre/post processing callbacks.
1623
+ * @returns The loaded CustomTool instance.
1624
+ */
1625
+ static load(data: Record<string, unknown>, context?: LoadContext): CustomTool;
1626
+ /**
1627
+ * Save the CustomTool instance to a dictionary.
1628
+ * @param context - Optional context with pre/post processing callbacks.
1629
+ * @returns The dictionary representation of this instance.
1630
+ */
1631
+ save(context?: SaveContext): Record<string, unknown>;
1632
+ /**
1633
+ * Convert the CustomTool instance to a YAML string.
1634
+ * @param context - Optional context with pre/post processing callbacks.
1635
+ * @returns The YAML string representation of this instance.
1636
+ */
1637
+ toYaml(context?: SaveContext): string;
1638
+ /**
1639
+ * Convert the CustomTool instance to a JSON string.
1640
+ * @param context - Optional context with pre/post processing callbacks.
1641
+ * @param indent - Number of spaces for indentation. Defaults to 2.
1642
+ * @returns The JSON string representation of this instance.
1643
+ */
1644
+ toJson(context?: SaveContext, indent?: number): string;
1645
+ /**
1646
+ * Load a CustomTool instance from a JSON string.
1647
+ * @param json - The JSON string to parse.
1648
+ * @param context - Optional context with pre/post processing callbacks.
1649
+ * @returns The loaded CustomTool instance.
1650
+ */
1651
+ static fromJson(json: string, context?: LoadContext): CustomTool;
1652
+ /**
1653
+ * Load a CustomTool instance from a YAML string.
1654
+ * @param yaml - The YAML string to parse.
1655
+ * @param context - Optional context with pre/post processing callbacks.
1656
+ * @returns The loaded CustomTool instance.
1657
+ */
1658
+ static fromYaml(yaml: string, context?: LoadContext): CustomTool;
1659
+ }
1660
+ /**
1661
+ * The MCP Server tool.
1662
+ *
1663
+ */
1664
+ declare class McpTool extends Tool {
1665
+ /**
1666
+ * The shorthand property name for this type, if any.
1667
+ */
1668
+ static readonly shorthandProperty: string | undefined;
1669
+ /**
1670
+ * The kind identifier for MCP tools
1671
+ */
1672
+ kind: string;
1673
+ /**
1674
+ * The connection configuration for the MCP tool
1675
+ */
1676
+ connection: Connection;
1677
+ /**
1678
+ * The server name of the MCP tool
1679
+ */
1680
+ serverName: string;
1681
+ /**
1682
+ * The description of the MCP tool
1683
+ */
1684
+ serverDescription?: string | undefined;
1685
+ /**
1686
+ * The approval mode for the MCP tool
1687
+ */
1688
+ approvalMode: McpApprovalMode;
1689
+ /**
1690
+ * List of allowed operations or resources for the MCP tool
1691
+ */
1692
+ allowedTools?: string[];
1693
+ /**
1694
+ * Initializes a new instance of McpTool.
1695
+ */
1696
+ constructor(init?: Partial<McpTool>);
1697
+ /**
1698
+ * Load a McpTool instance from a dictionary.
1699
+ * @param data - The dictionary containing the data.
1700
+ * @param context - Optional context with pre/post processing callbacks.
1701
+ * @returns The loaded McpTool instance.
1702
+ */
1703
+ static load(data: Record<string, unknown>, context?: LoadContext): McpTool;
1704
+ /**
1705
+ * Save the McpTool instance to a dictionary.
1706
+ * @param context - Optional context with pre/post processing callbacks.
1707
+ * @returns The dictionary representation of this instance.
1708
+ */
1709
+ save(context?: SaveContext): Record<string, unknown>;
1710
+ /**
1711
+ * Convert the McpTool instance to a YAML string.
1712
+ * @param context - Optional context with pre/post processing callbacks.
1713
+ * @returns The YAML string representation of this instance.
1714
+ */
1715
+ toYaml(context?: SaveContext): string;
1716
+ /**
1717
+ * Convert the McpTool instance to a JSON string.
1718
+ * @param context - Optional context with pre/post processing callbacks.
1719
+ * @param indent - Number of spaces for indentation. Defaults to 2.
1720
+ * @returns The JSON string representation of this instance.
1721
+ */
1722
+ toJson(context?: SaveContext, indent?: number): string;
1723
+ /**
1724
+ * Load a McpTool instance from a JSON string.
1725
+ * @param json - The JSON string to parse.
1726
+ * @param context - Optional context with pre/post processing callbacks.
1727
+ * @returns The loaded McpTool instance.
1728
+ */
1729
+ static fromJson(json: string, context?: LoadContext): McpTool;
1730
+ /**
1731
+ * Load a McpTool instance from a YAML string.
1732
+ * @param yaml - The YAML string to parse.
1733
+ * @param context - Optional context with pre/post processing callbacks.
1734
+ * @returns The loaded McpTool instance.
1735
+ */
1736
+ static fromYaml(yaml: string, context?: LoadContext): McpTool;
1737
+ }
1738
+ /**
1739
+ *
1740
+ *
1741
+ */
1742
+ declare class OpenApiTool extends Tool {
1743
+ /**
1744
+ * The shorthand property name for this type, if any.
1745
+ */
1746
+ static readonly shorthandProperty: string | undefined;
1747
+ /**
1748
+ * The kind identifier for OpenAPI tools
1749
+ */
1750
+ kind: string;
1751
+ /**
1752
+ * The connection configuration for the OpenAPI tool
1753
+ */
1754
+ connection: Connection;
1755
+ /**
1756
+ * The full OpenAPI specification
1757
+ */
1758
+ specification: string;
1759
+ /**
1760
+ * Initializes a new instance of OpenApiTool.
1761
+ */
1762
+ constructor(init?: Partial<OpenApiTool>);
1763
+ /**
1764
+ * Load a OpenApiTool instance from a dictionary.
1765
+ * @param data - The dictionary containing the data.
1766
+ * @param context - Optional context with pre/post processing callbacks.
1767
+ * @returns The loaded OpenApiTool instance.
1768
+ */
1769
+ static load(data: Record<string, unknown>, context?: LoadContext): OpenApiTool;
1770
+ /**
1771
+ * Save the OpenApiTool instance to a dictionary.
1772
+ * @param context - Optional context with pre/post processing callbacks.
1773
+ * @returns The dictionary representation of this instance.
1774
+ */
1775
+ save(context?: SaveContext): Record<string, unknown>;
1776
+ /**
1777
+ * Convert the OpenApiTool instance to a YAML string.
1778
+ * @param context - Optional context with pre/post processing callbacks.
1779
+ * @returns The YAML string representation of this instance.
1780
+ */
1781
+ toYaml(context?: SaveContext): string;
1782
+ /**
1783
+ * Convert the OpenApiTool instance to a JSON string.
1784
+ * @param context - Optional context with pre/post processing callbacks.
1785
+ * @param indent - Number of spaces for indentation. Defaults to 2.
1786
+ * @returns The JSON string representation of this instance.
1787
+ */
1788
+ toJson(context?: SaveContext, indent?: number): string;
1789
+ /**
1790
+ * Load a OpenApiTool instance from a JSON string.
1791
+ * @param json - The JSON string to parse.
1792
+ * @param context - Optional context with pre/post processing callbacks.
1793
+ * @returns The loaded OpenApiTool instance.
1794
+ */
1795
+ static fromJson(json: string, context?: LoadContext): OpenApiTool;
1796
+ /**
1797
+ * Load a OpenApiTool instance from a YAML string.
1798
+ * @param yaml - The YAML string to parse.
1799
+ * @param context - Optional context with pre/post processing callbacks.
1800
+ * @returns The loaded OpenApiTool instance.
1801
+ */
1802
+ static fromYaml(yaml: string, context?: LoadContext): OpenApiTool;
1803
+ }
1804
+
1805
+ /**
1806
+ * A Prompty is a markdown file format for LLM prompts. The frontmatter defines
1807
+ * structured metadata including model configuration, input/output schemas, tools,
1808
+ * and template settings. The markdown body becomes the instructions.
1809
+ *
1810
+ * This is the single root type for the Prompty schema — there is no abstract base
1811
+ * class or kind discriminator. A .prompty file always produces a Prompty instance.
1812
+ *
1813
+ */
1814
+ declare class Prompty {
1815
+ /**
1816
+ * The shorthand property name for this type, if any.
1817
+ */
1818
+ static readonly shorthandProperty: string | undefined;
1819
+ /**
1820
+ * Human-readable name of the prompt
1821
+ */
1822
+ name: string;
1823
+ /**
1824
+ * Display name for UI purposes
1825
+ */
1826
+ displayName?: string | undefined;
1827
+ /**
1828
+ * Description of the prompt's purpose
1829
+ */
1830
+ description?: string | undefined;
1831
+ /**
1832
+ * Additional metadata including authors, tags, and other arbitrary properties
1833
+ */
1834
+ metadata?: Record<string, unknown> | undefined;
1835
+ /**
1836
+ * Input parameters that participate in template rendering
1837
+ */
1838
+ inputs?: Property[];
1839
+ /**
1840
+ * Expected output format and structure
1841
+ */
1842
+ outputs?: Property[];
1843
+ /**
1844
+ * AI model configuration
1845
+ */
1846
+ model: Model;
1847
+ /**
1848
+ * Tools available for extended functionality
1849
+ */
1850
+ tools?: Tool[];
1851
+ /**
1852
+ * Template configuration for prompt rendering
1853
+ */
1854
+ template?: Template | undefined;
1855
+ /**
1856
+ * Clear directions on what the prompt should do. In .prompty files, this comes from the markdown body.
1857
+ */
1858
+ instructions?: string | undefined;
1859
+ /**
1860
+ * Initializes a new instance of Prompty.
1861
+ */
1862
+ constructor(init?: Partial<Prompty>);
1863
+ /**
1864
+ * Load a Prompty instance from a dictionary.
1865
+ * @param data - The dictionary containing the data.
1866
+ * @param context - Optional context with pre/post processing callbacks.
1867
+ * @returns The loaded Prompty instance.
1868
+ */
1869
+ static load(data: Record<string, unknown>, context?: LoadContext): Prompty;
1870
+ /**
1871
+ * Load a collection of Property from a dictionary or array.
1872
+ * @param data - The data to load from.
1873
+ * @param context - Optional context with pre/post processing callbacks.
1874
+ * @returns The loaded array of Property.
1875
+ */
1876
+ static loadInputs(data: unknown, context?: LoadContext): Property[];
1877
+ /**
1878
+ * Load a collection of Property from a dictionary or array.
1879
+ * @param data - The data to load from.
1880
+ * @param context - Optional context with pre/post processing callbacks.
1881
+ * @returns The loaded array of Property.
1882
+ */
1883
+ static loadOutputs(data: unknown, context?: LoadContext): Property[];
1884
+ /**
1885
+ * Load a collection of Tool from a dictionary or array.
1886
+ * @param data - The data to load from.
1887
+ * @param context - Optional context with pre/post processing callbacks.
1888
+ * @returns The loaded array of Tool.
1889
+ */
1890
+ static loadTools(data: unknown, context?: LoadContext): Tool[];
1891
+ /**
1892
+ * Save the Prompty instance to a dictionary.
1893
+ * @param context - Optional context with pre/post processing callbacks.
1894
+ * @returns The dictionary representation of this instance.
1895
+ */
1896
+ save(context?: SaveContext): Record<string, unknown>;
1897
+ /**
1898
+ * Save a collection of Property to object or array format.
1899
+ * @param items - The items to save.
1900
+ * @param context - Optional context with pre/post processing callbacks.
1901
+ * @returns The saved collection in object or array format.
1902
+ */
1903
+ static saveInputs(items: Property[], context?: SaveContext): Record<string, unknown> | Record<string, unknown>[];
1904
+ /**
1905
+ * Save a collection of Property to object or array format.
1906
+ * @param items - The items to save.
1907
+ * @param context - Optional context with pre/post processing callbacks.
1908
+ * @returns The saved collection in object or array format.
1909
+ */
1910
+ static saveOutputs(items: Property[], context?: SaveContext): Record<string, unknown> | Record<string, unknown>[];
1911
+ /**
1912
+ * Save a collection of Tool to object or array format.
1913
+ * @param items - The items to save.
1914
+ * @param context - Optional context with pre/post processing callbacks.
1915
+ * @returns The saved collection in object or array format.
1916
+ */
1917
+ static saveTools(items: Tool[], context?: SaveContext): Record<string, unknown> | Record<string, unknown>[];
1918
+ /**
1919
+ * Convert the Prompty instance to a YAML string.
1920
+ * @param context - Optional context with pre/post processing callbacks.
1921
+ * @returns The YAML string representation of this instance.
1922
+ */
1923
+ toYaml(context?: SaveContext): string;
1924
+ /**
1925
+ * Convert the Prompty instance to a JSON string.
1926
+ * @param context - Optional context with pre/post processing callbacks.
1927
+ * @param indent - Number of spaces for indentation. Defaults to 2.
1928
+ * @returns The JSON string representation of this instance.
1929
+ */
1930
+ toJson(context?: SaveContext, indent?: number): string;
1931
+ /**
1932
+ * Load a Prompty instance from a JSON string.
1933
+ * @param json - The JSON string to parse.
1934
+ * @param context - Optional context with pre/post processing callbacks.
1935
+ * @returns The loaded Prompty instance.
1936
+ */
1937
+ static fromJson(json: string, context?: LoadContext): Prompty;
1938
+ /**
1939
+ * Load a Prompty instance from a YAML string.
1940
+ * @param yaml - The YAML string to parse.
1941
+ * @param context - Optional context with pre/post processing callbacks.
1942
+ * @returns The loaded Prompty instance.
1943
+ */
1944
+ static fromYaml(yaml: string, context?: LoadContext): Prompty;
1945
+ }
1946
+
1947
+ /**
1948
+ * Plugin interfaces for the Prompty pipeline.
1949
+ *
1950
+ * Each pipeline step is defined as an interface. Implementations are
1951
+ * registered via the registry and discovered at runtime by key
1952
+ * (e.g., "nunjucks" for renderers, "openai" for executors).
1953
+ *
1954
+ * @module
1955
+ */
1956
+
1957
+ /**
1958
+ * Renders a template string with the given inputs.
1959
+ *
1960
+ * Discovered by: `agent.template.format.kind` (e.g., "nunjucks", "mustache").
1961
+ */
1962
+ interface Renderer {
1963
+ render(agent: Prompty, template: string, inputs: Record<string, unknown>): Promise<string>;
1964
+ }
1965
+ /**
1966
+ * Parses a rendered string into an array of abstract Messages.
1967
+ *
1968
+ * Discovered by: `agent.template.parser.kind` (e.g., "prompty").
1969
+ *
1970
+ * Optionally implements `preRender()` for nonce injection (strict mode).
1971
+ */
1972
+ interface Parser {
1973
+ parse(agent: Prompty, rendered: string, context?: Record<string, unknown>): Promise<Message[]>;
1974
+ /**
1975
+ * Optional hook called before rendering to sanitize the template
1976
+ * and produce context used during parsing.
1977
+ *
1978
+ * Returns `[sanitizedTemplate, context]`.
1979
+ */
1980
+ preRender?(template: string): [string, Record<string, unknown>];
1981
+ }
1982
+ /**
1983
+ * Sends messages to an LLM provider and returns the raw response.
1984
+ *
1985
+ * Discovered by: `agent.model.provider` (e.g., "openai", "azure").
1986
+ */
1987
+ interface Executor {
1988
+ execute(agent: Prompty, messages: Message[]): Promise<unknown>;
1989
+ }
1990
+ /**
1991
+ * Extracts clean results from raw LLM responses.
1992
+ *
1993
+ * Discovered by: `agent.model.provider` (e.g., "openai", "azure").
1994
+ */
1995
+ interface Processor {
1996
+ process(agent: Prompty, response: unknown): Promise<unknown>;
1997
+ }
1998
+
1999
+ /**
2000
+ * Plugin registry for Prompty pipeline components.
2001
+ *
2002
+ * TypeScript doesn't have Python's entry-point system, so we use
2003
+ * explicit registration. Built-in implementations are registered
2004
+ * when the package is imported (see src/index.ts).
2005
+ *
2006
+ * Third-party plugins call `registerRenderer()`, etc. at module load.
2007
+ *
2008
+ * @module
2009
+ */
2010
+
2011
+ declare function registerRenderer(key: string, impl: Renderer): void;
2012
+ declare function registerParser(key: string, impl: Parser): void;
2013
+ declare function registerExecutor(key: string, impl: Executor): void;
2014
+ declare function registerProcessor(key: string, impl: Processor): void;
2015
+ declare class InvokerError extends Error {
2016
+ readonly group: string;
2017
+ readonly key: string;
2018
+ constructor(group: string, key: string);
2019
+ }
2020
+ declare function getRenderer(key: string): Renderer;
2021
+ declare function getParser(key: string): Parser;
2022
+ declare function getExecutor(key: string): Executor;
2023
+ declare function getProcessor(key: string): Processor;
2024
+ /** Clear all registered implementations. Useful in tests. */
2025
+ declare function clearCache(): void;
2026
+
2027
+ /**
2028
+ * Connection registry for pre-configured SDK clients.
2029
+ *
2030
+ * Executors look up registered connections when
2031
+ * `model.connection.kind === "reference"`.
2032
+ *
2033
+ * @module
2034
+ */
2035
+ /**
2036
+ * Register a pre-configured SDK client by name.
2037
+ *
2038
+ * @example
2039
+ * ```ts
2040
+ * import OpenAI from "openai";
2041
+ * registerConnection("my-openai", new OpenAI({ apiKey: "sk-..." }));
2042
+ * ```
2043
+ */
2044
+ declare function registerConnection(name: string, client: unknown): void;
2045
+ /**
2046
+ * Look up a registered connection.
2047
+ * @throws {Error} if the name is not registered.
2048
+ */
2049
+ declare function getConnection(name: string): unknown;
2050
+ /** Remove all registered connections. Useful in tests. */
2051
+ declare function clearConnections(): void;
2052
+
2053
+ /**
2054
+ * Prompty loader — loads .prompty files into typed Prompty objects.
2055
+ *
2056
+ * Splits frontmatter (YAML) from the markdown body, resolves
2057
+ * `${protocol:value}` references (env vars, file includes),
2058
+ * and delegates to `Prompty.load()`.
2059
+ *
2060
+ * @module
2061
+ */
2062
+
2063
+ /**
2064
+ * Load a `.prompty` file and return a typed `Prompty`.
2065
+ *
2066
+ * @param path - File system path to a `.prompty` file.
2067
+ * @returns Fully typed Prompty definition.
2068
+ */
2069
+ declare function load(path: string): Prompty;
2070
+
2071
+ /**
2072
+ * Four-step execution pipeline.
2073
+ *
2074
+ * ```
2075
+ * execute(prompt, inputs) → top-level orchestrator
2076
+ * ├── prepare(agent, inputs) → template → wire format
2077
+ * │ ├── render(agent, inputs) → template + inputs → rendered string
2078
+ * │ └── parse(agent, rendered) → rendered string → Message[]
2079
+ * └── run(agent, messages) → LLM call → clean result
2080
+ * ├── Executor.execute(...) → messages → raw LLM response
2081
+ * └── process(agent, response) → raw response → clean result
2082
+ * ```
2083
+ *
2084
+ * Each leaf step is independently traced. Users can bring their own
2085
+ * Renderer, Parser, Executor, Processor via the registry.
2086
+ *
2087
+ * @module
2088
+ */
2089
+
2090
+ /**
2091
+ * Validate and fill defaults for agent inputs.
2092
+ */
2093
+ declare function validateInputs(agent: Prompty, inputs: Record<string, unknown>): Record<string, unknown>;
2094
+ /**
2095
+ * Render the template with inputs.
2096
+ *
2097
+ * Discovered by: `agent.template.format.kind` (default: "nunjucks").
2098
+ */
2099
+ declare function render(agent: Prompty, inputs: Record<string, unknown>): Promise<string>;
2100
+ /**
2101
+ * Parse a rendered string into abstract messages.
2102
+ *
2103
+ * Discovered by: `agent.template.parser.kind` (default: "prompty").
2104
+ */
2105
+ declare function parse(agent: Prompty, rendered: string, context?: Record<string, unknown>): Promise<Message[]>;
2106
+ /**
2107
+ * Process a raw LLM response into a clean result.
2108
+ *
2109
+ * Discovered by: `agent.model.provider` (default: "openai").
2110
+ */
2111
+ declare function process(agent: Prompty, response: unknown): Promise<unknown>;
2112
+ /**
2113
+ * Render template + parse into messages + expand thread markers.
2114
+ */
2115
+ declare function prepare(agent: Prompty, inputs?: Record<string, unknown>): Promise<Message[]>;
2116
+ /**
2117
+ * Execute messages against the LLM and process the response.
2118
+ */
2119
+ declare function run(agent: Prompty, messages: Message[], options?: {
2120
+ raw?: boolean;
2121
+ }): Promise<unknown>;
2122
+ /**
2123
+ * Full pipeline: load → prepare → run.
2124
+ */
2125
+ declare function execute(prompt: string | Prompty, inputs?: Record<string, unknown>, options?: {
2126
+ raw?: boolean;
2127
+ }): Promise<unknown>;
2128
+ /**
2129
+ * Run a prompt with automatic tool-call execution loop.
2130
+ */
2131
+ declare function executeAgent(prompt: string | Prompty, inputs?: Record<string, unknown>, options?: {
2132
+ tools?: Record<string, (...args: unknown[]) => unknown>;
2133
+ maxIterations?: number;
2134
+ raw?: boolean;
2135
+ }): Promise<unknown>;
2136
+ declare const runAgent: typeof executeAgent;
2137
+
2138
+ /**
2139
+ * Nunjucks renderer — Jinja2-compatible template rendering for TypeScript.
2140
+ *
2141
+ * Nunjucks is the standard Jinja2-compatible engine for Node.js.
2142
+ * This renderer replaces thread-kind inputs with nonce markers
2143
+ * before rendering.
2144
+ *
2145
+ * @module
2146
+ */
2147
+
2148
+ declare class NunjucksRenderer implements Renderer {
2149
+ render(agent: Prompty, template: string, inputs: Record<string, unknown>): Promise<string>;
2150
+ }
2151
+
2152
+ /**
2153
+ * Mustache renderer — logic-less template rendering.
2154
+ *
2155
+ * @module
2156
+ */
2157
+
2158
+ declare class MustacheRenderer implements Renderer {
2159
+ render(agent: Prompty, template: string, inputs: Record<string, unknown>): Promise<string>;
2160
+ }
2161
+
2162
+ /**
2163
+ * Prompty chat parser — splits rendered text into abstract messages.
2164
+ *
2165
+ * Recognizes role markers (`system:`, `user:`, `assistant:`, `developer:`)
2166
+ * and inline markdown images. Supports nonce-based sanitization when
2167
+ * `Format.strict` is enabled.
2168
+ *
2169
+ * @module
2170
+ */
2171
+
2172
+ declare class PromptyChatParser implements Parser {
2173
+ preRender(template: string): [string, Record<string, unknown>];
2174
+ parse(agent: Prompty, rendered: string, context?: Record<string, unknown>): Promise<Message[]>;
2175
+ private resolveBasePath;
2176
+ private parseMessages;
2177
+ private buildMessage;
2178
+ private parseAttrs;
2179
+ private parseContent;
2180
+ private resolveImage;
2181
+ }
2182
+
2183
+ /**
2184
+ * Tracing framework — multi-backend registry with function wrappers.
2185
+ *
2186
+ * Matches the Python tracing architecture:
2187
+ * - `Tracer` registry holds named backends
2188
+ * - `trace()` wraps async functions with span tracking
2189
+ * - `traceSpan()` creates manual spans
2190
+ * - Each backend receives `(key, value)` events
2191
+ *
2192
+ * @module
2193
+ */
2194
+ /** A tracer backend receives (key, value) events for a span. */
2195
+ type TracerBackend = (key: string, value: unknown) => void;
2196
+ /** Factory: given a span signature, return a backend (or null to skip). */
2197
+ type TracerFactory = (signature: string) => TracerBackend | null;
2198
+ declare const Tracer: {
2199
+ /**
2200
+ * Register a tracer backend.
2201
+ *
2202
+ * @param name - Unique name for this backend.
2203
+ * @param factory - Called for each new span; return a callback or null.
2204
+ */
2205
+ add(name: string, factory: TracerFactory): void;
2206
+ /** Remove a tracer backend by name. */
2207
+ remove(name: string): void;
2208
+ /** Remove all backends. */
2209
+ clear(): void;
2210
+ /**
2211
+ * Start a new trace span. Returns a callback for emitting events
2212
+ * and a `end()` function to close the span.
2213
+ */
2214
+ start(signature: string): SpanEmitter;
2215
+ };
2216
+ interface SpanEmitter {
2217
+ (key: string, value: unknown): void;
2218
+ end: () => void;
2219
+ }
2220
+ /**
2221
+ * Wrap an async function with tracing.
2222
+ *
2223
+ * Creates a span with the function name, traces inputs and output,
2224
+ * and measures duration.
2225
+ *
2226
+ * @param fn - The async function to wrap.
2227
+ * @param name - Optional span name (defaults to `fn.name`).
2228
+ * @returns Wrapped function with same signature.
2229
+ */
2230
+ declare function trace<T extends (...args: unknown[]) => Promise<unknown>>(fn: T, name?: string): T;
2231
+ /**
2232
+ * Execute a callback within a traced span.
2233
+ *
2234
+ * @param name - Span name.
2235
+ * @param fn - Callback receiving a `(key, value)` emitter.
2236
+ * @returns The callback's return value.
2237
+ */
2238
+ declare function traceSpan<T>(name: string, fn: (emit: (key: string, value: unknown) => void) => Promise<T>): Promise<T>;
2239
+ /**
2240
+ * Method decorator that wraps a class method with tracing.
2241
+ *
2242
+ * ```typescript
2243
+ * class MyService {
2244
+ * @traceMethod()
2245
+ * async chat(question: string): Promise<string> { ... }
2246
+ * }
2247
+ * ```
2248
+ *
2249
+ * @param attributes - Optional key-value pairs to emit at the start of each span.
2250
+ */
2251
+ declare function traceMethod(attributes?: Record<string, unknown>): (_target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
2252
+ /** Redact sensitive values from trace output. */
2253
+ declare function sanitizeValue(key: string, value: unknown): unknown;
2254
+ /**
2255
+ * Convert an arbitrary object to a JSON-serializable form.
2256
+ * Handles Date, Error, Map, Set, etc.
2257
+ */
2258
+ declare function toSerializable(obj: unknown): unknown;
2259
+
2260
+ /**
2261
+ * Console tracer backend — prints trace events to stderr.
2262
+ *
2263
+ * @module
2264
+ */
2265
+
2266
+ /**
2267
+ * A tracer factory that prints all span events to stderr.
2268
+ *
2269
+ * @example
2270
+ * ```ts
2271
+ * import { Tracer } from "prompty";
2272
+ * import { consoleTracer } from "prompty/tracing";
2273
+ * Tracer.add("console", consoleTracer);
2274
+ * ```
2275
+ */
2276
+ declare const consoleTracer: TracerFactory;
2277
+
2278
+ /**
2279
+ * File-writing tracer backend — writes hierarchical `.tracy` JSON files.
2280
+ *
2281
+ * Mirrors the Python `PromptyTracer`: captures timing, usage metrics,
2282
+ * and nested call frames, then writes a `.tracy` file on root span completion.
2283
+ *
2284
+ * @module
2285
+ */
2286
+
2287
+ /**
2288
+ * JSON file trace backend that writes `.tracy` files to disk.
2289
+ *
2290
+ * Each completed root span is written as a `.tracy` file in the configured
2291
+ * output directory, using the format: `{spanName}.{YYYYMMDD.HHMMSS}.tracy`
2292
+ *
2293
+ * @example
2294
+ * ```ts
2295
+ * import { Tracer } from "@prompty/core";
2296
+ * import { PromptyTracer } from "@prompty/core";
2297
+ *
2298
+ * const pt = new PromptyTracer({ outputDir: "./.runs" });
2299
+ * Tracer.add("prompty", pt.factory);
2300
+ * ```
2301
+ */
2302
+ declare class PromptyTracer {
2303
+ private outputDir;
2304
+ private version;
2305
+ private stack;
2306
+ /** The path of the last written `.tracy` file, if any. */
2307
+ lastTracePath: string | undefined;
2308
+ constructor(options?: {
2309
+ outputDir?: string;
2310
+ version?: string;
2311
+ });
2312
+ /**
2313
+ * The tracer factory — pass this to `Tracer.add()`.
2314
+ *
2315
+ * Arrow function so `this` is bound correctly.
2316
+ */
2317
+ factory: TracerFactory;
2318
+ private endSpan;
2319
+ private hoistUsage;
2320
+ private writeTrace;
2321
+ private serializeFrame;
2322
+ /** Format a Date to match the Python PromptyTracer format: `YYYY-MM-DDTHH:MM:SS.ffffff` */
2323
+ private formatDateTime;
2324
+ private sanitizeName;
2325
+ }
2326
+
2327
+ export { Prompty as AgentDefinition, AnonymousConnection, ApiKeyConnection, ArrayProperty, type AudioPart, Binding, Connection, type ContentPart, CustomTool, type Executor, type FilePart, Format, FoundryConnection, FunctionTool, type ImagePart, InvokerError, LoadContext, McpApprovalMode, McpTool, Message, Model, ModelOptions, MustacheRenderer, NunjucksRenderer, OAuthConnection, ObjectProperty, OpenApiTool, type Parser, type Processor, Prompty as PromptAgent, Prompty, PromptyChatParser, PromptyStream, PromptyTracer, Property, RICH_KINDS, ROLES, ReferenceConnection, RemoteConnection, type Renderer, type Role, SaveContext, Parser$1 as SchemaParser, type SpanEmitter, Template, type TextPart, ThreadMarker, Tool, type ToolCall, Tracer, type TracerBackend, type TracerFactory, clearCache, clearConnections, consoleTracer, dictContentToPart, dictToMessage, execute, executeAgent, getConnection, getExecutor, getParser, getProcessor, getRenderer, load, parse, prepare, process, registerConnection, registerExecutor, registerParser, registerProcessor, registerRenderer, render, run, runAgent, sanitizeValue, text, textMessage, toSerializable, trace, traceMethod, traceSpan, validateInputs };